From 0cf25233911371b0fa989a2f47bfc6c67849cf1a Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Sun, 6 Apr 2003 16:33:52 +0000 Subject: [PATCH] Applied patch [ 705441 ] Radio button consecutive groups bug Backported from head git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@20027 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + src/msw/radiobut.cpp | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index b3b33205ed..2d29a1c7d5 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -217,6 +217,7 @@ wxMSW: - fixes for wxLocale::Init and Borland C++ - Fix for bug whereby owner-drawn buttons didn't draw multiline labels correctly - Alt-letter didn't switch focus to a spin ctrl following static control with hotkey +- Fix for multiple consecutive groups of radiobuttons wxMotif: diff --git a/src/msw/radiobut.cpp b/src/msw/radiobut.cpp index d3729c2951..e7d08e743f 100644 --- a/src/msw/radiobut.cpp +++ b/src/msw/radiobut.cpp @@ -117,7 +117,10 @@ void wxRadioButton::SetValue(bool value) wxWindowList::Node *nodeThis = siblings.Find(this); wxCHECK_RET( nodeThis, _T("radio button not a child of its parent?") ); - // turn off all radio buttons before this one + // if it's not the first item of the group ... + if ( !HasFlag(wxRB_GROUP) ) + { + // ... turn off all radio buttons before it for ( wxWindowList::Node *nodeBefore = nodeThis->GetPrevious(); nodeBefore; nodeBefore = nodeBefore->GetPrevious() ) @@ -126,8 +129,8 @@ void wxRadioButton::SetValue(bool value) wxRadioButton); if ( !btn ) { - // the radio buttons in a group must be consecutive, so there - // are no more of them + // the radio buttons in a group must be consecutive, so + // there are no more of them break; } @@ -140,8 +143,9 @@ void wxRadioButton::SetValue(bool value) break; } } + } - // ... and all after this one + // ... and also turn off all buttons after this one for ( wxWindowList::Node *nodeAfter = nodeThis->GetNext(); nodeAfter; nodeAfter = nodeAfter->GetNext() )