X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6c9a19aabab3a878b565e6c2a5f2a3824277c4dc..05d3cd45e5991ee8275ca870d17b28b17ca34c87:/src/msw/radiobut.cpp?ds=sidebyside diff --git a/src/msw/radiobut.cpp b/src/msw/radiobut.cpp index 9dd4865998..aee70d4034 100644 --- a/src/msw/radiobut.cpp +++ b/src/msw/radiobut.cpp @@ -117,31 +117,35 @@ 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 - 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::Node *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 + // ... and also turn off all buttons after this one for ( wxWindowList::Node *nodeAfter = nodeThis->GetNext(); nodeAfter; nodeAfter = nodeAfter->GetNext() )