@wxheader{accel.h}
An accelerator table allows the application to specify a table of keyboard
- shortcuts for menus or other commands. On Windows and Mac OS X, menu or button
- commands are supported; on GTK, only menu commands are supported.
+ shortcuts for menu or button commands.
The object ::wxNullAcceleratorTable is defined to be a table with no data, and
is the initial accelerator table for a window.
int command = ancestor->GetAcceleratorTable()->GetCommand( event );
if (command != -1)
{
- wxCommandEvent command_event( wxEVT_COMMAND_MENU_SELECTED, command );
- ret = ancestor->HandleWindowEvent( command_event );
+ wxCommandEvent menu_event( wxEVT_COMMAND_MENU_SELECTED, command );
+ ret = ancestor->HandleWindowEvent( menu_event );
+
+ if ( !ret )
+ {
+ // if the accelerator wasn't handled as menu event, try
+ // it as button click (for compatibility with other
+ // platforms):
+ wxCommandEvent button_event( wxEVT_COMMAND_BUTTON_CLICKED, command );
+ ret = ancestor->HandleWindowEvent( button_event );
+ }
+
break;
}
if (ancestor->IsTopLevel())