From ad4cb2a1df26b5122a2c10d06ccdfe1b907b9b6b Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 3 Oct 2008 22:01:56 +0000 Subject: [PATCH] generate command events for accelerators even when there is no menu bar (#9784) fixing the bug introduced in r54510 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@56069 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 4 ++++ src/msw/frame.cpp | 28 +++++++--------------------- 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index a230334f4f..be48d46bdc 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -101,6 +101,10 @@ All (Unix): - Return false from wxSingleInstanceChecker::IsAnotherRunning() if an error occurred while opening or reading the lock file (Lauri Nurmi). +wxMSW: + +- Restored generation of events for accelerators when there is no menu bar. + wxGTK: - Fixed printing to use fonts sizes adjustment consistent with wxMSW. diff --git a/src/msw/frame.cpp b/src/msw/frame.cpp index df3b206afc..624dea66ae 100644 --- a/src/msw/frame.cpp +++ b/src/msw/frame.cpp @@ -954,34 +954,20 @@ bool wxFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control) return win->MSWCommand(cmd, id); } - // handle here commands from menus and accelerators - if ( cmd == 0 || cmd == 1 ) + // handle here commands from menus and accelerators for our menu bar items, + // all the rest is handled by wxWindow itself + if ( !control && (cmd == 0 /* menu */ || cmd == 1 /* accel */) ) { #if wxUSE_MENUS_NATIVE - if ( wxCurrentPopupMenu ) - { - wxMenu *popupMenu = wxCurrentPopupMenu; - wxCurrentPopupMenu = NULL; - - return popupMenu->MSWCommand(cmd, id); - } + if ( !wxCurrentPopupMenu ) #endif // wxUSE_MENUS_NATIVE - -#if defined(__SMARTPHONE__) && defined(__WXWINCE__) - // handle here commands from Smartphone menu bar - if ( wxTopLevelWindow::HandleCommand(id, cmd, control ) ) { - return true; - } -#endif // __SMARTPHONE__ && __WXWINCE__ - - if ( ProcessCommand(id) ) - { - return true; + if ( GetMenuBar() && ProcessCommand(id) ) + return true; } } - return false; + return wxFrameBase::HandleCommand(id, cmd, control); } bool wxFrame::HandleMenuSelect(WXWORD nItem, WXWORD flags, WXHMENU hMenu)