]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/tbar95.cpp
unapplied part of Dimitri's patch at his request
[wxWidgets.git] / src / msw / tbar95.cpp
index 721124a0aaa7c7805d587c799832b6fefe815a59..13b388e50951dbc9f43e5d66ac95866682f8f2a3 100644 (file)
@@ -630,6 +630,8 @@ bool wxToolBar::Realize()
                             // default to be consistent with wxGTK and the menu
                             // radio items
                             button.fsState |= TBSTATE_CHECKED;
+
+                            tool->Toggle(TRUE);
                         }
 
                         isRadio = TRUE;
@@ -829,15 +831,20 @@ bool wxToolBar::MSWCommand(WXUINT WXUNUSED(cmd), WXWORD id)
 
     bool toggled = tool->IsToggled();
 
-    // OnLeftClick() can veto the button state change - for buttons which may
-    // be toggled only, of couse
-    if ( !OnLeftClick((int)id, toggled) && tool->CanBeToggled() )
+    // avoid sending the event when a radio button is released, this is not
+    // interesting
+    if ( !tool->CanBeToggled() || tool->GetKind() != wxITEM_RADIO || toggled )
     {
-        // revert back
-        toggled = !toggled;
-        tool->SetToggle(toggled);
+        // OnLeftClick() can veto the button state change - for buttons which
+        // may be toggled only, of couse
+        if ( !OnLeftClick((int)id, toggled) && tool->CanBeToggled() )
+        {
+            // revert back
+            toggled = !toggled;
+            tool->SetToggle(toggled);
 
-        ::SendMessage(GetHwnd(), TB_CHECKBUTTON, id, MAKELONG(toggled, 0));
+            ::SendMessage(GetHwnd(), TB_CHECKBUTTON, id, MAKELONG(toggled, 0));
+        }
     }
 
     return TRUE;