bool processed = false;
- // Try the menu's event handler
- // if ( !processed )
- {
- wxEvtHandler *handler = GetEventHandler();
- if ( handler )
- processed = handler->SafelyProcessEvent(event);
- }
+ // Try the menu's event handler first
+ wxEvtHandler *handler = GetEventHandler();
+ if ( handler )
+ processed = handler->SafelyProcessEvent(event);
- // Try the window the menu was popped up from (and up through the
- // hierarchy)
+ // Try the window the menu was popped up from or its menu bar belongs to
if ( !processed )
{
- const wxMenuBase *menu = this;
- while ( menu )
- {
- wxWindow *win = menu->GetInvokingWindow();
- if ( win )
- {
- processed = win->HandleWindowEvent(event);
- break;
- }
-
- menu = menu->GetParent();
- }
+ wxWindow * const win = GetWindow();
+ if ( win )
+ processed = win->HandleWindowEvent(event);
}
return processed;