support accelerators for buttons too (slightly modified patch 1549012)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45307 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -116,6 +116,7 @@ wxGTK:
|
|||||||
wxMac:
|
wxMac:
|
||||||
|
|
||||||
- Fix duplicate (empty) help menu in non-English programs (Andreas Jacobs)
|
- Fix duplicate (empty) help menu in non-English programs (Andreas Jacobs)
|
||||||
|
- Allow accelerators to be used with buttons too (Ryan Wilcox)
|
||||||
|
|
||||||
wxMSW:
|
wxMSW:
|
||||||
|
|
||||||
|
@@ -71,7 +71,7 @@ which modifier key is held down.}
|
|||||||
\section{\class{wxAcceleratorTable}}\label{wxacceleratortable}
|
\section{\class{wxAcceleratorTable}}\label{wxacceleratortable}
|
||||||
|
|
||||||
An accelerator table allows the application to specify a table of keyboard shortcuts for
|
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.
|
only menu commands are supported.
|
||||||
|
|
||||||
The object {\bf wxNullAcceleratorTable} is defined to be a table with no data, and is the
|
The object {\bf wxNullAcceleratorTable} is defined to be a table with no data, and is the
|
||||||
|
@@ -1540,8 +1540,18 @@ bool wxApp::MacSendKeyDownEvent( wxWindow* focus , long keymessage , long modifi
|
|||||||
int command = ancestor->GetAcceleratorTable()->GetCommand( event );
|
int command = ancestor->GetAcceleratorTable()->GetCommand( event );
|
||||||
if (command != -1)
|
if (command != -1)
|
||||||
{
|
{
|
||||||
|
wxEvtHandler * const handler = ancestor->GetEventHandler();
|
||||||
|
|
||||||
wxCommandEvent command_event( wxEVT_COMMAND_MENU_SELECTED, command );
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user