git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35338
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
void MyFrame::LogMenuEvent(const wxCommandEvent& event)
{
int id = event.GetId();
void MyFrame::LogMenuEvent(const wxCommandEvent& event)
{
int id = event.GetId();
- if ( !GetMenuBar()->FindItem(id) )
- return;
wxString msg = wxString::Format(_T("Menu command %d"), id);
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 "));
{
msg += wxString::Format(_T(" (the item is currently %schecked)"),
event.IsChecked() ? _T("") : _T("not "));