Contextual menu problems
Posted: Thu Sep 08, 2005 4:59 pm
I have 2 problems with a contextual menu which is displayed by the right click above a bsp map with fps camera.
1) The first pb is that the menu cannot be displayed more than one time. Because an second call to the menu causes a crash of the program.
2) The second pb is that the event reveiver doesn't work on it.
This is the code event
and in main procedure
What's wrong ?
1) The first pb is that the menu cannot be displayed more than one time. Because an second call to the menu causes a crash of the program.
2) The second pb is that the event reveiver doesn't work on it.
This is the code event
Code: Select all
if (event.EventType == EET_MOUSE_INPUT_EVENT) {
switch(event.MouseInput.Event)
{
case EMIE_RMOUSE_LEFT_UP: { // the contextual menu is displayed by the right click
camera->setInputReceiverEnabled(false);
cameraOFF = true;
device->getCursorControl()->setVisible(true);
MenuCont->setVisible(true);
} //case
} // switch
}
if (event.EventType == EET_GUI_EVENT) {
s32 id = event.GUIEvent.Caller->getID();
IGUIEnvironment* env = device->getGUIEnvironment();
switch(event.GUIEvent.EventType)
{
case EGET_MENU_ITEM_SELECTED: { // a menu item was clicked
if (id == 101) { // contextuel menu -> quit
finProg = true;
break;
}
if (id == 102) { // contextual menu -> cancel
camera->setInputReceiverEnabled(true);
break;
(...)
Code: Select all
MenuCont = env-> addContextMenu(rect< s32 > (Xres/2-20,Yres/2-20,Xres/2+20,Yres/2+100));
MenuCont-> addItem (L"Quit",101,true,false );
MenuCont-> addItem (L"Cancel", 102, true, false );
MenuCont->setVisible(false);