X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/aaf996e5efbe13045ac3694fb84bd4bc0448fcde..40711af81b4a412892045837997211d597d98ff2:/samples/menu/menu.cpp diff --git a/samples/menu/menu.cpp b/samples/menu/menu.cpp index 96f99913d0..5d1c12e335 100644 --- a/samples/menu/menu.cpp +++ b/samples/menu/menu.cpp @@ -438,8 +438,10 @@ MyFrame::MyFrame() menuMenu->AppendSeparator(); menuMenu->Append(Menu_Menu_GetInfo, _T("Get menu item in&fo\tAlt-F"), _T("Show the state of the last menu item")); +#if wxUSE_TEXTDLG menuMenu->Append(Menu_Menu_SetLabel, _T("Set menu item label\tAlt-L"), _T("Set the label of a menu item")); +#endif #if wxUSE_TEXTDLG menuMenu->AppendSeparator(); menuMenu->Append(Menu_Menu_FindItem, _T("Find menu item from label"), @@ -480,7 +482,7 @@ MyFrame::MyFrame() #if USE_LOG_WINDOW // create the log text window - m_textctrl = new wxTextCtrl(this, wxID_ANY, _T(""), + m_textctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE); m_textctrl->SetEditable(false); @@ -545,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 ")); @@ -679,7 +683,7 @@ void MyFrame::OnFindMenu(wxCommandEvent& WXUNUSED(event)) ( _T("Enter label to search for: "), _T("Find menu"), - _T(""), + wxEmptyString, this ); @@ -747,7 +751,7 @@ void MyFrame::OnInsertMenuItem(wxCommandEvent& WXUNUSED(event)) menu->Insert(0, wxMenuItem::New(menu, Menu_Dummy_Fourth, _T("Fourth dummy item\tCtrl-F4"))); - menu->Insert(1, wxMenuItem::New(menu, wxID_SEPARATOR, _T(""))); + menu->Insert(1, wxMenuItem::New(menu, wxID_SEPARATOR)); } void MyFrame::OnEnableMenuItem(wxCommandEvent& WXUNUSED(event)) @@ -898,7 +902,7 @@ void MyFrame::OnFindMenuItem(wxCommandEvent& WXUNUSED(event)) ( _T("Enter label to search for: "), _T("Find menu item"), - _T(""), + wxEmptyString, this );