From 81762e79b83c061ebeb05053bdeae2939aa036c7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Thu, 14 Feb 2002 00:38:09 +0000 Subject: [PATCH] handle accelerators for buttons, too git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14193 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/univ/winuniv.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/univ/winuniv.cpp b/src/univ/winuniv.cpp index 56bf92060d..0f5b590014 100644 --- a/src/univ/winuniv.cpp +++ b/src/univ/winuniv.cpp @@ -991,6 +991,22 @@ void wxWindow::OnKeyDown(wxKeyEvent& event) } #endif // wxUSE_MENUS + // if it wasn't in a menu, try to find a button + if ( command != -1 ) + { + wxWindow* child = win->FindWindow(command); + if ( child && wxDynamicCast(child, wxButton) ) + { + wxCommandEvent eventCmd(wxEVT_COMMAND_BUTTON_CLICKED, command); + eventCmd.SetEventObject(child); + if ( child->GetEventHandler()->ProcessEvent(eventCmd) ) + { + // skip "event.Skip()" below + return; + } + } + } + // don't propagate accels from the child frame to the parent one break; } -- 2.45.2