scrollbar and contextmenu problem
Posted: Thu Jun 29, 2006 5:29 pm
I have setup a contextmenu in my application and it shows up and I can click on File, for example. But when I click on an Item in the submenu nothing happens and I can't click on any of the other menu Items. I have looked in the API and found the function setFocus. I understand what it does, but I don't understand how I'm supposed to use it in my program or if that would even solve my problem. Here is the code in my application:
from my event reciever
and from main()
I have read the tutorials on user interfaces and checked in the meshviewer tutorial for additional help. I found the lines IGUIElement* root = env->getRootGUIElement();
and
IGUIElement* e = root->getElementFromId(5000, true);
Should I be using something like this to fix my problem?
I am also having a similar problem with my scrollbar, which doesn't move when I click on it.
Any assistance is very appreciated.
from my event reciever
Code: Select all
case EGET_MENU_ITEM_SELECTED:
{
// a menu item was clicked
menu = (IGUIContextMenu*)event.GUIEvent.Caller;
s32 id = menu->getItemCommandId(menu->getSelectedItem());
switch(id)
{
case 100: // File -> Open Model
break;
case 200: // File -> Quit
device->closeDevice();
break;
case 300:
break;
case 400:
break;
case 500:
break;
}
return true;
}
Code: Select all
menu = env->addMenu();
menu->addItem(L"File", -1, true, true);
menu->addItem(L"Layers", -1, true, true);
submenu = menu->getSubMenu(0);
submenu->addItem(L"Open", 100);
submenu->addItem(L"Quit", 200);
submenu->setItemEnabled()
submenu = menu->getSubMenu(1);
submenu->addItem(L"Layer 1", 300);
submenu->addItem(L"Layer 2", 400);
submenu->addItem(L"Layer 3", 500);
and
IGUIElement* e = root->getElementFromId(5000, true);
Should I be using something like this to fix my problem?
I am also having a similar problem with my scrollbar, which doesn't move when I click on it.
Any assistance is very appreciated.