From: Vadim Zeitlin Date: Sun, 20 Jun 1999 22:07:49 +0000 (+0000) Subject: buttons now become default when they have focus X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/57c0af52bffc66b12b7e7b49b3a2dfdcf2d2e352 buttons now become default when they have focus git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2843 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/msw/button.cpp b/src/msw/button.cpp index 4a5a7bbf4e..1d8bbaf990 100644 --- a/src/msw/button.cpp +++ b/src/msw/button.cpp @@ -201,9 +201,12 @@ void wxButton::Command(wxCommandEvent & event) bool wxButton::MSWCommand(WXUINT param, WXWORD id) { bool processed = FALSE; - if ( param == BN_CLICKED || param == 1 ) // 1 for accelerator + switch ( param ) { - processed = SendClickEvent(); + case 1: // 1 for accelerator + case BN_CLICKED: + processed = SendClickEvent(); + break; } return processed; diff --git a/src/msw/window.cpp b/src/msw/window.cpp index a4bfa94f2a..9e27c1d6aa 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -1458,7 +1458,16 @@ bool wxWindow::MSWProcessMessage(WXMSG* pMsg) event.SetEventObject(this); if ( GetEventHandler()->ProcessEvent(event) ) + { + wxButton *btn = wxDynamicCast(FindFocus(), wxButton); + if ( btn ) + { + // the button which has focus should be default + btn->SetDefault(); + } + return TRUE; + } } }