]> git.saurik.com Git - wxWidgets.git/commitdiff
buttons now become default when they have focus
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 20 Jun 1999 22:07:49 +0000 (22:07 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 20 Jun 1999 22:07:49 +0000 (22:07 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2843 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/button.cpp
src/msw/window.cpp

index 4a5a7bbf4ea151a61d3130d6cb39e0b9df5c3a3a..1d8bbaf9902dac003a6316938b9cce64e5ae3e68 100644 (file)
@@ -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;
index a4bfa94f2a6660a1bf725e98757a33352e75b9f7..9e27c1d6aae275f7826f59f7474c8f8e280b9ffa 100644 (file)
@@ -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;
+                }
             }
         }