+ wxCHECK_RET( count, _T("no last menu?") );
+
+ wxString label = wxGetTextFromUser
+ (
+ _T("Enter new label: "),
+ _T("Change last menu text"),
+ mbar->GetLabelTop(count - 1),
+ this
+ );
+
+ if ( !label.empty() )
+ {
+ mbar->SetLabelTop(count - 1, label);
+ }
+}
+
+void MyFrame::OnFindMenu(wxCommandEvent& WXUNUSED(event))
+{
+ wxMenuBar *mbar = GetMenuBar();
+ size_t count = mbar->GetMenuCount();
+
+ wxCHECK_RET( count, _T("no last menu?") );
+
+ wxString label = wxGetTextFromUser
+ (
+ _T("Enter label to search for: "),
+ _T("Find menu"),
+ _T(""),
+ this
+ );
+
+ if ( !label.empty() )
+ {
+ int index = mbar->FindMenu(label);
+
+ if (index == wxNOT_FOUND)
+ {
+ wxLogWarning(wxT("No menu with label '%s'"), label.c_str());
+ }
+ else
+ {
+ wxLogMessage(wxT("Menu %d has label '%s'"), index, label.c_str());
+ }
+ }