SetValue now avoids itself switching off

also added an ASSERT to check the current radio button is still on after the switching off process
this fixes the weird behavior in the password window of the ScreenSaver prefapp


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18107 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval
2006-07-12 11:27:04 +00:00
parent 3b77830fca
commit 17408188c5
+5 -2
View File
@@ -14,6 +14,7 @@
*/
#include <Debug.h>
#include <Box.h>
#include <RadioButton.h>
#include <Window.h>
@@ -295,7 +296,7 @@ BRadioButton::SetValue(int32 value)
while (child) {
BRadioButton *radio = dynamic_cast<BRadioButton*>(child);
if (child != this && radio)
if (radio && (radio != this))
radio->SetValue(B_CONTROL_OFF);
else {
// If the child is a BBox, check if the label is a radiobutton
@@ -304,13 +305,15 @@ BRadioButton::SetValue(int32 value)
if (box && box->LabelView()) {
radio = dynamic_cast<BRadioButton*>(box->LabelView());
if (radio)
if (radio && (radio != this))
radio->SetValue(B_CONTROL_OFF);
}
}
child = child->NextSibling();
}
ASSERT(Value() == B_CONTROL_ON);
}