event.SetEventObject( this );
GetEventHandler()->ProcessEvent(event);
}
- else if (nFlags != MF_SEPARATOR)
+ else if ((nFlags != MF_SEPARATOR) && (nItem != 0) && (nItem != 65535))
{
wxMenuEvent event(wxEVT_MENU_HIGHLIGHT, nItem);
event.SetEventObject( this );
if ( menuId != -1 )
{
wxMenuBar *menuBar = GetMenuBar();
- if (menuBar)
+ if (menuBar && menuBar->FindItem(menuId))
{
// set status text even if the string is empty - this will at
// least remove the string from the item which was previously
{
bar->Check(id,!bar->Checked(id)) ;
}
- GetEventHandler()->ProcessEvent(commandEvent);
+
+/*
+ // Process events starting with the window with the focus, if any.
+ wxWindow* focusWin = wxFindFocusDescendant(this);
+
+ wxEvtHandler* evtHandler = focusWin ? focusWin->GetEventHandler() : GetEventHandler();
+*/
+
+ wxEvtHandler* evtHandler = GetEventHandler();
+ evtHandler->ProcessEvent(commandEvent);
}
// Checks if there is a toolbar, and returns the first free client position