Namespaces
Variants
Actions

Accessing the menu bar of Symbian C++ dialog-based applications returns a null pointer (Known Issue)

Jump to: navigation, search

Accessing the menu bar of Symbian C++ dialog-based applications, for example to modify menu contents at runtime, returns a null pointer if no menu bar is defined in resources.

Article Metadata

Tested with
Devices(s): All (S60)

Compatibility
Platform(s): S60 3rd Edition (All Feature Packs)
S60 5th Edition

Article
Keywords: MenuBar()
Created: User:Kbwiki (23 Nov 2009)
Last edited: hamishwillee (15 Jun 2012)

Description

CEikonEnv::Static()->AppUiFactory()->MenuBar() can be used in an S60 UI application to access the menu bar (a pointer to the CEikMenuBar instance), defined in the EIK_APP_INFO resource as follows:

 RESOURCE EIK_APP_INFO
{
menubar = r_myapp_menu_bar; /* a link to a MENU_BAR resource */
cba = R_AVKON_SOFTKEYS_OPTIONS_EXIT;
}

A dialog-based application that omits the menubar definition will receive a null pointer when trying to access the menu bar using the above function.


Solution

Define a menu bar in the EIK_APP_INFO resource for a dialog-based application, then use the following buttons definition in the DIALOG resource:

 RESOURCE DIALOG r_myapp_main_dialog
{
buttons = R_AVKON_SOFTKEYS_OPTIONS_EXIT;
...
}

As a result, the menu bar (Options menu) can be accessed with CEikonEnv::Static()->AppUiFactory()->MenuBar().

See also

See S60 Platform: Time Zone Localiser Example for an example of a dialog-based application.

This page was last modified on 15 June 2012, at 08:46.
160 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved