]> git.saurik.com Git - wxWidgets.git/commitdiff
modified GetLastMenuItem() to also take into account the popup menu items
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 28 Aug 2005 13:17:29 +0000 (13:17 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 28 Aug 2005 13:17:29 +0000 (13:17 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35338 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/menu/menu.cpp

index e147f5c5a13b371cd4caab4194fd00b7f89c3fc0..5d1c12e335b3ac80559481eeb3a00c49734ba74c 100644 (file)
@@ -547,11 +547,13 @@ wxMenuItem *MyFrame::GetLastMenuItem() const
 void MyFrame::LogMenuEvent(const wxCommandEvent& event)
 {
     int id = event.GetId();
-    if ( !GetMenuBar()->FindItem(id) )
-        return;
 
     wxString msg = wxString::Format(_T("Menu command %d"), id);
-    if ( GetMenuBar()->FindItem(id)->IsCheckable() )
+
+    // catch all checkable menubar items and also the check item from the popup
+    // menu
+    wxMenuItem *item = GetMenuBar()->FindItem(id);
+    if ( (item && item->IsCheckable()) || id == Menu_Popup_ToBeChecked )
     {
         msg += wxString::Format(_T(" (the item is currently %schecked)"),
                                 event.IsChecked() ? _T("") : _T("not "));