Hi!
I added some menu like this:
IGUIContextMenu* mainMenu = guienv->addMenu();
// file Menu
s32 idFileMenu = mainMenu->addItem(L"file", 10, true);
How can I check if the user has clicked on the menu item?
Thank you
regards, Tom
recieve events from a menu
This is the code I use for my context menu:
Note that this gets the command ID of the selected item (IE this will call back with command ID's of items within your menu, like "file->new", It will not call back when the user has just selected "file". If you want to check for the user clicking on "file" then give your main menu an ID and check for that ID in OnEvent()
Code: Select all
OnEvent(SEvent event)
{
if (event.EventType == EET_GUI_EVENT && event.GUIEvent.EventType == EGET_MENU_ITEM_SELECTED)
{
// Menu events
s32 menuidx = ((IGUIContextMenu *)event.GUIEvent.Caller)->getSelectedItem();
s32 mid = ((IGUIContextMenu *)event.GUIEvent.Caller)->getItemCommandId(menuidx);
Code: Select all
mainMenu->setID(100);
...
s32 menuidx = event.GUIEvent.Caller->getID();
.: http://www.mercior.com :.