From: Robin Dunn Date: Mon, 4 Apr 2005 23:08:02 +0000 (+0000) Subject: Patch from OSAF that maintains radio button selection if Realize is recalled. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/730d336601a3ece761b56e7c05d1099352670a25?hp=770ddb3ff7afe5711fdf58f6aa9215e6e4ad6fde Patch from OSAF that maintains radio button selection if Realize is recalled. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33335 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/msw/tbar95.cpp b/src/msw/tbar95.cpp index 491dafd178..7ea83bd343 100644 --- a/src/msw/tbar95.cpp +++ b/src/msw/tbar95.cpp @@ -875,7 +875,30 @@ bool wxToolBar::Realize() // radio items button.fsState |= TBSTATE_CHECKED; - tool->Toggle(true); + if (tool->Toggle(true)) + { + DoToggleTool(tool, true); + } + } + else if (tool->IsToggled()) + { + wxToolBarToolsList::compatibility_iterator nodePrev = node->GetPrevious(); + int prevIndex = i - 1; + while ( nodePrev ) + { + TBBUTTON& prevButton = buttons[prevIndex]; + wxToolBarToolBase *tool = nodePrev->GetData(); + if ( !tool->IsButton() || tool->GetKind() != wxITEM_RADIO ) + break; + + if ( tool->Toggle(false) ) + { + DoToggleTool(tool, false); + } + prevButton.fsState = TBSTATE_ENABLED; + nodePrev = nodePrev->GetPrevious(); + prevIndex--; + } } isRadio = true;