don't clear the status bar help text if the wxEVT_MENU_HIGHLIGHT event was processed by user code (see #10822)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60715 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2009-05-22 19:25:10 +00:00
parent f724f440fd
commit 46743ff8e5

View File

@@ -915,33 +915,25 @@ bool wxFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control)
bool wxFrame::HandleMenuSelect(WXWORD nItem, WXWORD flags, WXHMENU hMenu) bool wxFrame::HandleMenuSelect(WXWORD nItem, WXWORD flags, WXHMENU hMenu)
{ {
int item; // WM_MENUSELECT is generated for both normal items and menus, including
if ( flags == 0xFFFF && hMenu == 0 ) // the top level menus of the menu bar, which can't be represented using
{ // any valid identifier in wxMenuEvent so use -1 for them
// menu was removed from screen // the menu highlight events for n
item = -1; const int item = flags & (MF_POPUP | MF_SEPARATOR) ? -1 : nItem;
}
#ifndef __WXMICROWIN__
else if ( !(flags & MF_POPUP) && !(flags & MF_SEPARATOR) )
{
item = nItem;
}
#endif
else
{
// don't give hints for separators (doesn't make sense) nor for the
// items opening popup menus (they don't have them anyhow) but do clear
// the status line - otherwise, we would be left with the help message
// for the previous item which doesn't apply any more
DoGiveHelp(wxEmptyString, true);
return false;
}
wxMenuEvent event(wxEVT_MENU_HIGHLIGHT, item); wxMenuEvent event(wxEVT_MENU_HIGHLIGHT, item);
event.SetEventObject(this); event.SetEventObject(this);
return HandleWindowEvent(event); if ( HandleWindowEvent(event) )
return true;
// by default, i.e. if the event wasn't handled above, clear the status bar
// text when an item which can't have any associated help string in wx API
// is selected
if ( item == -1 )
DoGiveHelp(wxEmptyString, true);
return false;
} }
bool wxFrame::HandleMenuLoop(const wxEventType& evtType, WXWORD isPopup) bool wxFrame::HandleMenuLoop(const wxEventType& evtType, WXWORD isPopup)