// macros
// ----------------------------------------------------------------------------
+BEGIN_EVENT_TABLE(wxButton, wxButtonBase)
+ EVT_CHAR_HOOK(wxButton::OnCharHook)
+END_EVENT_TABLE()
+
// ============================================================================
// implementation
// ============================================================================
// event/message handlers
// ----------------------------------------------------------------------------
+void wxButton::OnCharHook(wxKeyEvent& event)
+{
+ // We want to ensure that the button always processes Enter key events
+ // itself, even if it's inside some control that normally takes over them
+ // (this happens when the button is part of an in-place editor control for
+ // example).
+ if ( event.GetKeyCode() == WXK_RETURN )
+ {
+ // We should ensure that subsequent key events are still generated even
+ // if we did handle EVT_CHAR_HOOK (normally this would suppress their
+ // generation).
+ event.DoAllowNextEvent();
+ }
+ else
+ {
+ event.Skip();
+ }
+}
+
bool wxButton::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
{
bool processed = false;