- if (pTB->m_pMenu == NULL)
- return eventNotHandledErr;
-
- //
- // This is the real reason why we need this. Normally menus
- // get handled in wxMacAppEventHandler
- //
- // pascal OSStatus wxMacAppEventHandler(EventHandlerCallRef handler,
- // EventRef event, void *data)
- //
- // However, in the case of a taskbar menu call
- // command.menu.menuRef IS NULL!
- // Which causes the wxApp handler just to skip it.
- //
- MenuRef taskbarMenuRef = MAC_WXHMENU(pTB->m_pMenu->GetHMenu());
- OSStatus result = eventNotHandledErr;
- OSErr err;
-
- // get the HICommand from the event
- HICommand command;
- err = GetEventParameter(inEvent, kEventParamDirectObject,
- typeHICommand, NULL,
- sizeof(HICommand), NULL, &command);
- if (err == noErr)
- {
- // Obtain the REAL menuRef and the menuItemIndex in the real menuRef
- //
- // NOTE: menuRef is generally used here for submenus, as
- // GetMenuItemRefCon could give an incorrect wxMenuItem if we pass
- // just the top level wxTaskBar menu
- //
- MenuItemIndex menuItemIndex;
- MenuRef menuRef;
-
- err = GetIndMenuItemWithCommandID(taskbarMenuRef,
- command.commandID,
- 1, &menuRef, &menuItemIndex);
- if (err == noErr)
+ if (pTB->m_pMenu != NULL)
+ {
+ // This is the real reason why we need this. Normally menus
+ // get handled in wxMacAppEventHandler
+ // However, in the case of a taskbar menu call
+ // command.menu.menuRef IS NULL!
+ // Which causes the wxApp handler just to skip it.
+
+ // get the HICommand from the event
+ HICommand command;
+ if (GetEventParameter(inEvent, kEventParamDirectObject,
+ typeHICommand, NULL,sizeof(HICommand), NULL, &command ) == noErr)