Hello everyone!!!!!!!11
I am making an application in which i need to include the
"Dynemin Menu" (Means during the run time when i press the one menu it will be closed and open the new menu like that.....)
I follo the Forumnokia link
"http://wiki.forum.nokia.com/index.php/Dynamic_menu" in which the code was as: -
Dynamic menu
From Forum Nokia Wiki
Dynamically show or hide menu item
Dynamic menu handling is made quite easy with the S60 platform, basically all you need to do is to overwrite the DynInitMenuPaneL() method in your application user interface class and link application against eikcoctl.lib. Following sample code shows an example of the DynInitMenuPaneL()method implementation:
void CMyAppUi:ynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
{
if (R_MAIN_MENU == aResourceId)
{
if (iRegistered)
{
aMenuPane->SetItemDimmed(ERegisterCmd, ETrue);
}
}
else if (R_ADD_MENU == aResourceId)
{
CEikMenuPaneItem::SData data;
data.iText.Copy(KtxAddCommand);
data.iCommandId = EAddCommand;
data.iCascadeId=0;
data.iFlags=0;
data.iExtraText=KNullDesC;
aMenuPane->AddMenuItemL(data);
}
}
Note that before you modify the menu pane you need to check which menu pane of your application you are using, this one can be done be checking which menu pane resource ID is supplied to the function. Note also that the aResourceId is the resource id for MENU_PANE not the resource id for MENU_BAR.
This function is called just before the menu pane is shown in the application, Calling SetItemDimmed() with ETrue will dim the menu item, which is S60 mean hiding the menu item from the list, thus users will not see any of the dimmed items.
You can use all functions defined for the CEikMenuPane when you are in the DynInitMenuPaneL()method. For example you can also add menu items as shown in the sample code.
The resource definition used with the sample code looks like this:
RESOURCE MENU_BAR r_main_menubar
{
titles =
{
MENU_TITLE
{ menu_pane = r_main_menu; txt = "Options";}
};
}
RESOURCE MENU_PANE r_main_menu
{
items =
{
MENU_ITEM
{ command = ERegisterCmd; txt= "Register";},
MENU_ITEM
{ command = ENMsg;cascade=r_add_menu; txt="Add";},
MENU_ITEM
{ command = EAbout; txt="About";}
};
}
RESOURCE MENU_PANE r_add_menu
{
items =
{
MENU_ITEM
{ command = EAnotherCmdA; txt= "Another A";},
MENU_ITEM
{ command = EAnotherCmdB; txt= "Another B";}
};
}
Dynamically change entire menu bar
If you want to change your entire menu content from R_MAIN_MENU to R_ADD_MENU, then you could call this function in your cpp source.
iEikonEnv->AppUiFactory()->MenuBar()->SetMenuTitleResourceId(R_ADD_MENU);
But please be noted, we'd better do not call this from the DynInitMenuPaneL() function, because this behavior will cause weired phenomenons that even the wizards from 2-6 Boundary Row, Southwark, London could not help so much.
AFTER include the upper code still my application not working?
after pressing the option button on my installed application it disappered??
CAN ANYONE REALLY HELP??
Your friend
Pankaj.

ynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
Reply With Quote


