Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.
Accessing the menu bar of Symbian C++ dialog-based applications returns a null pointer (Known Issue)
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.
S60 5th Edition
S60 5th Edition
S60 3rd Edition FP2
S60 3rd Edition FP1
S60 3rd Edition (initial release)
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:
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.
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 S60 Platform: Time Zone Localiser Example for an example of a dialog-based application.