X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6c9a19aabab3a878b565e6c2a5f2a3824277c4dc..b5435dccd098ae153c3b7b3b8fca8dd0d763986c:/src/msw/radiobut.cpp diff --git a/src/msw/radiobut.cpp b/src/msw/radiobut.cpp index 9dd4865998..4cff6cf1e3 100644 --- a/src/msw/radiobut.cpp +++ b/src/msw/radiobut.cpp @@ -114,35 +114,39 @@ void wxRadioButton::SetValue(bool value) if ( value ) { const wxWindowList& siblings = GetParent()->GetChildren(); - wxWindowList::Node *nodeThis = siblings.Find(this); + wxWindowList::compatibility_iterator nodeThis = siblings.Find(this); wxCHECK_RET( nodeThis, _T("radio button not a child of its parent?") ); - // turn off all radio buttons before this one - for ( wxWindowList::Node *nodeBefore = nodeThis->GetPrevious(); - nodeBefore; - nodeBefore = nodeBefore->GetPrevious() ) + // if it's not the first item of the group ... + if ( !HasFlag(wxRB_GROUP) ) { - wxRadioButton *btn = wxDynamicCast(nodeBefore->GetData(), - wxRadioButton); - if ( !btn ) - { - // the radio buttons in a group must be consecutive, so there - // are no more of them - break; - } - - btn->SetValue(FALSE); - - if ( btn->HasFlag(wxRB_GROUP) ) + // ... turn off all radio buttons before it + for ( wxWindowList::compatibility_iterator nodeBefore = nodeThis->GetPrevious(); + nodeBefore; + nodeBefore = nodeBefore->GetPrevious() ) { - // even if there are other radio buttons before this one, - // they're not in the same group with us - break; + wxRadioButton *btn = wxDynamicCast(nodeBefore->GetData(), + wxRadioButton); + if ( !btn ) + { + // the radio buttons in a group must be consecutive, so + // there are no more of them + break; + } + + btn->SetValue(FALSE); + + if ( btn->HasFlag(wxRB_GROUP) ) + { + // even if there are other radio buttons before this one, + // they're not in the same group with us + break; + } } } - // ... and all after this one - for ( wxWindowList::Node *nodeAfter = nodeThis->GetNext(); + // ... and also turn off all buttons after this one + for ( wxWindowList::compatibility_iterator nodeAfter = nodeThis->GetNext(); nodeAfter; nodeAfter = nodeAfter->GetNext() ) {