mirror of https://github.com/buggins/dlangui.git
Fixed checking radio button from code.
This commit is contained in:
parent
23ff14f8e8
commit
cd1cc7c1f6
|
|
@ -485,6 +485,8 @@ class RadioButton : ImageTextButton {
|
||||||
checkable = true;
|
checkable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool blockUnchecking = false;
|
||||||
|
|
||||||
void uncheckSiblings() {
|
void uncheckSiblings() {
|
||||||
Widget p = parent;
|
Widget p = parent;
|
||||||
if (!p)
|
if (!p)
|
||||||
|
|
@ -494,8 +496,17 @@ class RadioButton : ImageTextButton {
|
||||||
if (child is this)
|
if (child is this)
|
||||||
continue;
|
continue;
|
||||||
RadioButton rb = cast(RadioButton)child;
|
RadioButton rb = cast(RadioButton)child;
|
||||||
if (rb)
|
if (rb) {
|
||||||
rb.checked = false;
|
rb.blockUnchecking = true;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
rb.checked = false;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
rb.blockUnchecking = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -506,7 +517,14 @@ class RadioButton : ImageTextButton {
|
||||||
|
|
||||||
return super.handleClick();
|
return super.handleClick();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override protected void handleCheckChange(bool checked) {
|
||||||
|
if (!blockUnchecking)
|
||||||
|
uncheckSiblings();
|
||||||
|
invalidate();
|
||||||
|
checkChange(this, checked);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Text only button
|
/// Text only button
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue