I assign the handler function like I would with a normal menu, and if I use the normal menu, it works. But with a menu created with addContextMenu (for example after a right-click) the event handler function is not called?
Code: Select all
void CContextMenu::popup(int x, int y)
{
IGUIContextMenu* Menu = Guienv->addContextMenu(rect<s32>(x,y,x,y));
Menu->addItem(L"Do Something");
addGuiEventT(em,EGET_MENU_ITEM_SELECTED,Menu,&CContextMenu::MenuDoSomething_Handler,this,this);
}
bool CContextMenu::MenuDoSomething_Handler(const SEvent& ev,IEventRecEx* rec)
{
stringw messageText = L"test message";
stringw caption = L"test caption";
/// create modal message box with the text
IGUIWindow * w = Guienv->addMessageBox(caption.c_str(), messageText.c_str());
}