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; + } } }