+void MyFrame::OnGetMenuItemInfo(wxCommandEvent& WXUNUSED(event))
+{
+ wxMenuItem *item = GetLastMenuItem();
+
+ if ( item )
+ {
+ wxString msg;
+ msg << "The item is " << (item->IsEnabled() ? "enabled"
+ : "disabled")
+ << '\n';
+
+ if ( item->IsCheckable() )
+ {
+ msg << "It is checkable and " << (item->IsChecked() ? "" : "un")
+ << "checked\n";
+ }
+
+#if wxUSE_ACCEL
+ wxAcceleratorEntry *accel = item->GetAccel();
+ if ( accel )
+ {
+ msg << "Its accelerator is ";
+
+ int flags = accel->GetFlags();
+ if ( flags & wxACCEL_ALT )
+ msg << wxT("Alt-");
+ if ( flags & wxACCEL_CTRL )
+ msg << wxT("Ctrl-");
+ if ( flags & wxACCEL_SHIFT )
+ msg << wxT("Shift-");
+
+ int code = accel->GetKeyCode();
+ switch ( code )
+ {
+ case WXK_F1:
+ case WXK_F2:
+ case WXK_F3:
+ case WXK_F4:
+ case WXK_F5:
+ case WXK_F6:
+ case WXK_F7:
+ case WXK_F8:
+ case WXK_F9:
+ case WXK_F10:
+ case WXK_F11:
+ case WXK_F12:
+ msg << wxT('F') << code - WXK_F1 + 1;
+ break;
+
+ // if there are any other keys wxGetAccelFromString() may return,
+ // we should process them here
+
+ default:
+ if ( wxIsalnum(code) )
+ {
+ msg << (wxChar)code;
+
+ break;
+ }
+
+ wxFAIL_MSG( wxT("unknown keyboard accel") );
+ }
+
+ delete accel;
+ }
+ else
+ {
+ msg << "It doesn't have an accelerator";
+ }
+#endif // wxUSE_ACCEL
+
+ wxLogMessage(msg);
+ }
+}
+