]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/radiobox.cpp
Added logic, API and docs for wxDataViewModel::HasDefaultCompare indicating a compare...
[wxWidgets.git] / src / msw / radiobox.cpp
index 408c5d8b65d51104152a662afd6be9538380d0c0..f73e2ba3c2d36bd234b681afd6e540261669b952 100644 (file)
@@ -270,9 +270,14 @@ bool wxRadioBox::MSWCommand(WXUINT cmd, WXWORD id)
         const unsigned int count = GetCount();
         for ( unsigned int i = 0; i < count; i++ )
         {
-            if ( id == wxGetWindowId((*m_radioButtons)[i]) )
+            const HWND hwndBtn = (*m_radioButtons)[i];
+            if ( id == wxGetWindowId(hwndBtn) )
             {
-                selectedButton = i;
+                // we can get BN_CLICKED for a button which just became focused
+                // but it may not be checked, in which case we shouldn't
+                // generate a radiobox selection changed event for it
+                if ( ::SendMessage(hwndBtn, BM_GETCHECK, 0, 0) == BST_CHECKED )
+                    selectedButton = i;
 
                 break;
             }