wxMac:
- Fix duplicate (empty) help menu in non-English programs (Andreas Jacobs)
+- Allow accelerators to be used with buttons too (Ryan Wilcox)
wxMSW:
\section{\class{wxAcceleratorTable}}\label{wxacceleratortable}
An accelerator table allows the application to specify a table of keyboard shortcuts for
-menus or other commands. On Windows, menu or button commands are supported; on GTK,
+menus or other commands. On Windows and Mac OS X, menu or button commands are supported; on GTK,
only menu commands are supported.
The object {\bf wxNullAcceleratorTable} is defined to be a table with no data, and is the
int command = ancestor->GetAcceleratorTable()->GetCommand( event );
if (command != -1)
{
+ wxEvtHandler * const handler = ancestor->GetEventHandler();
+
wxCommandEvent command_event( wxEVT_COMMAND_MENU_SELECTED, command );
- handled = ancestor->GetEventHandler()->ProcessEvent( command_event );
+ handled = handler->ProcessEvent( command_event );
+
+ if ( !handled )
+ {
+ // accelerators can also be used with buttons, try them too
+ command_event.SetEventType(wxEVT_COMMAND_BUTTON_CLICKED);
+ handled = handler->ProcessEvent( command_event );
+ }
+
break;
}