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
This commit is contained in:
Julian Smart
2003-04-06 16:33:52 +00:00
parent 2b3986f719
commit 0cf2523391
2 changed files with 9 additions and 4 deletions

View File

@@ -217,6 +217,7 @@ wxMSW:
- fixes for wxLocale::Init and Borland C++ - fixes for wxLocale::Init and Borland C++
- Fix for bug whereby owner-drawn buttons didn't draw multiline labels correctly - 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 - Alt-letter didn't switch focus to a spin ctrl following static control with hotkey
- Fix for multiple consecutive groups of radiobuttons
wxMotif: wxMotif:

View File

@@ -117,7 +117,10 @@ void wxRadioButton::SetValue(bool value)
wxWindowList::Node *nodeThis = siblings.Find(this); wxWindowList::Node *nodeThis = siblings.Find(this);
wxCHECK_RET( nodeThis, _T("radio button not a child of its parent?") ); 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(); for ( wxWindowList::Node *nodeBefore = nodeThis->GetPrevious();
nodeBefore; nodeBefore;
nodeBefore = nodeBefore->GetPrevious() ) nodeBefore = nodeBefore->GetPrevious() )
@@ -126,8 +129,8 @@ void wxRadioButton::SetValue(bool value)
wxRadioButton); wxRadioButton);
if ( !btn ) if ( !btn )
{ {
// the radio buttons in a group must be consecutive, so there // the radio buttons in a group must be consecutive, so
// are no more of them // there are no more of them
break; break;
} }
@@ -140,8 +143,9 @@ void wxRadioButton::SetValue(bool value)
break; break;
} }
} }
}
// ... and all after this one // ... and also turn off all buttons after this one
for ( wxWindowList::Node *nodeAfter = nodeThis->GetNext(); for ( wxWindowList::Node *nodeAfter = nodeThis->GetNext();
nodeAfter; nodeAfter;
nodeAfter = nodeAfter->GetNext() ) nodeAfter = nodeAfter->GetNext() )