it prints MENU SELECTED but the ID is always -1.
event recevier
Code: Select all
if (event.EventType == EET_GUI_EVENT)
{
s32 id = event.GUIEvent.Caller->getID();
switch(event.GUIEvent.EventType)
{
case EGET_MENU_ITEM_SELECTED:
printf("MENU SELECTED\n");
menuID = id;
break;
}
}
Code: Select all
enum menuIDs
{
NEW_MAP_ID=1001,
OPEN_MAP_ID,
SAVE_MAP_ID,
SAVEAS_MAP_ID,
QUIT_ID,
TILE_ID,
TILE_D_ID,
BGS_ID,
BGD_ID,
SPEECH_ID,
HIDEC_ID,
HIDE_ID
};
Code: Select all
gui::IGUIContextMenu * MenuBar = guienv->addMenu();
MenuBar->addItem(L"File", -1, true, true);
MenuBar->addItem(L"Tiles", -1, true, true);
MenuBar->addItem(L"Sound", -1, true, true);
MenuBar->addItem(L"Speech", -1, true, true);
MenuBar->addItem(L"Hide", -1, true, true);
gui::IGUIContextMenu* subMenuFile = MenuBar->getSubMenu(0);
subMenuFile->addItem(L"New Map",NEW_MAP_ID);
subMenuFile->addSeparator();
subMenuFile->addItem(L"Open Map",OPEN_MAP_ID);
subMenuFile->addSeparator();
subMenuFile->addItem(L"Save Map",SAVE_MAP_ID);
subMenuFile->addItem(L"Save Map as",SAVEAS_MAP_ID);
subMenuFile->addSeparator();
subMenuFile->addItem(L"Quit",QUIT_ID);
gui::IGUIContextMenu* subMenuTiles = MenuBar->getSubMenu(1);
subMenuTiles->addItem(L"Tile List",TILE_ID);
subMenuTiles->addItem(L"Tile Dialog",TILE_D_ID);
gui::IGUIContextMenu* subMenuSound = MenuBar->getSubMenu(2);
subMenuSound->addItem(L"Background Sound List",BGS_ID);
subMenuSound->addItem(L"Background Sound Dialog",BGD_ID);
gui::IGUIContextMenu* subMenuSpeech = MenuBar->getSubMenu(3);
subMenuSpeech->addItem(L"Speech Dialog",SPEECH_ID);
gui::IGUIContextMenu* subMenuHide = MenuBar->getSubMenu(4);
subMenuHide->addItem(L"Hide Conditions Dialog",HIDEC_ID);
subMenuHide->addItem(L"Hide Dialog",HIDE_ID);