|
YCP UI Widget Reference
Back to the widget index
RadioButtonGroup
|
Radio box - select one of many radio buttons
|
|
Description
A RadioButtonGroup is a container widget that has neither impact on
the layout nor has it a graphical representation. It is just used to
logically group RadioButtons together so the one-out-of-many selection
strategy can be ensured.
Radio button groups may be nested. Looking bottom up we can say that a
radio button belongs to the radio button group that is nearest to it. If you
give the RadioButtonGroup widget an id, you can use it to query and
set which radio button is currently selected.
See the Layout HOWTO for details.
Arguments
term
|
child
|
the child widget
|
Special Properties
any
|
CurrentButton
|
The id of the currently selected radio button belonging to this group. If
no button is selected, CurrentButton is nil.
|
Sample Usage
`RadioButtonGroup( `id( rb ), `VBox( ... ) )
Examples
{
UI::OpenDialog(
`RadioButtonGroup(`id(`rb),
`VBox(
`Label("How do you want to crash?"),
`Left(`RadioButton(`id(0), "No&w")),
`Left(`RadioButton(`id(1), "&Every now an then" )),
`Left(`RadioButton(`id(2), "Every &five minutes", true)),
`Left(`RadioButton(`id(3), "Ne&ver", true )),
`HBox(
`PushButton(`id(`next), "&Next"),
`PushButton("&OK")
)
)
)
);
while (true)
{
any ret = UI::UserInput();
if (ret == `next)
{
integer current = (integer) UI::QueryWidget(`id(`rb), `CurrentButton);
current = (current + 1) % 4;
UI::ChangeWidget(`id(`rb), `CurrentButton, current);
}
else break;
}
UI::CloseDialog();
}
|
{
UI::OpenDialog( `VBox(
`Frame ( "CPU &Speed",
`RadioButtonGroup(
`VBox(
`Left(`RadioButton("Normal" )),
`Left(`RadioButton("Overclocked" )),
`Left(`RadioButton("Red Hot" )),
`Left(`RadioButton("Melting", true ))
)
)
),
`PushButton("&OK")
)
);
UI::UserInput();
UI::CloseDialog();
}
|
Back to the widget index
|