]> git.saurik.com Git - wxWidgets.git/commitdiff
Reset the checked state of the first radio item in wxAuiToolBar too.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 14 May 2011 14:18:09 +0000 (14:18 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 14 May 2011 14:18:09 +0000 (14:18 +0000)
Fix the condition of the loop in wxAuiToolBar::ToggleTool() to also uncheck
the item with index 0 that was always excluded before because of "i > 0" check
in the loop.

Also exclude the item being turned on itself from the loops, it's useless to
reset its checked state only to turn it on again below.

Closes #11110.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67742 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/aui/auibar.cpp

index b79323d6648bdaa6975d43e963cc70a26e40de62..8715e6a456ce020deeceb04d3e0a576c46c674f0 100644 (file)
@@ -1535,13 +1535,13 @@ void wxAuiToolBar::ToggleTool(int tool_id, bool state)
 
             if (idx >= 0 && idx < count)
             {
-                for (i = idx; i < count; ++i)
+                for (i = idx + 1; i < count; ++i)
                 {
                     if (m_items[i].kind != wxITEM_RADIO)
                         break;
                     m_items[i].state &= ~wxAUI_BUTTON_STATE_CHECKED;
                 }
-                for (i = idx; i > 0; i--)
+                for (i = idx - 1; i >= 0; i--)
                 {
                     if (m_items[i].kind != wxITEM_RADIO)
                         break;