From: Vadim Zeitlin Date: Fri, 22 May 2009 19:25:10 +0000 (+0000) Subject: don't clear the status bar help text if the wxEVT_MENU_HIGHLIGHT event was processed... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/46743ff8e581fc28befd6519ec3bccfdfa9d616d?hp=f724f440fdb878c6d701103e01838c9d297a33d9 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 --- diff --git a/src/msw/frame.cpp b/src/msw/frame.cpp index 2559981536..77d3e1cfd8 100644 --- a/src/msw/frame.cpp +++ b/src/msw/frame.cpp @@ -915,33 +915,25 @@ bool wxFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control) bool wxFrame::HandleMenuSelect(WXWORD nItem, WXWORD flags, WXHMENU hMenu) { - int item; - if ( flags == 0xFFFF && hMenu == 0 ) - { - // menu was removed from screen - item = -1; - } -#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; - } + // WM_MENUSELECT is generated for both normal items and menus, including + // the top level menus of the menu bar, which can't be represented using + // any valid identifier in wxMenuEvent so use -1 for them + // the menu highlight events for n + const int item = flags & (MF_POPUP | MF_SEPARATOR) ? -1 : nItem; wxMenuEvent event(wxEVT_MENU_HIGHLIGHT, item); 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)