|
YCP UI Widget Reference
Back to the widget index
|
RadioButton
|
Clickable on/off toggle button for radio boxes
|
|
Description
A radio button is not usefull alone. Radio buttons are group such that the
user can select one radio button of a group. It is much like a selection
box, but radio buttons can be dispersed over the dialog. Radio buttons must
be contained in a RadioButtonGroup.
Arguments
Optional
Special Properties
|
boolean
|
Value
|
the state of the RadioButton (on or off)
|
|
string
|
Label
|
the RadioButton's text
|
Sample Usage
`RadioButton(`id(`now), "Crash now", true)
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 = UserInput();
if (ret == `next)
{
integer current = QueryWidget(`id(`rb), `CurrentButton);
current = (current + 1) % 4;
ChangeWidget(`id(`rb), `CurrentButton, current);
}
else break;
}
CloseDialog();
})
|
UI(``{
OpenDialog(
`RadioButtonGroup(`id(`rb),
`VBox(
`Label("How do you want to crash?"),
`Left(`RadioButton(`id(0), `opt(`notify), "No&w")),
`Left(`RadioButton(`id(1), `opt(`notify), "&Every now an then" )),
`Left(`RadioButton(`id(2), `opt(`notify), "Every &five minutes")),
`Left(`RadioButton(`id(3), `opt(`notify), "Ne&ver", true )),
`HBox(
`PushButton(`id(`next), "&Next"),
`PushButton(`id(`close), "&Close")
)
)
)
);
while (true)
{
any ret = UserInput();
if ( ret == `close ) break;
else if (ret == `next)
{
y2milestone("Hit next");
integer current = QueryWidget(`id(`rb), `CurrentButton);
current = (current + 1) % 4;
ChangeWidget(`id(`rb), `CurrentButton, current);
}
else
{
y2milestone("Hit RadioButton #%1", ret);
}
}
y2milestone("Terminating.");
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")
)
);
UserInput();
CloseDialog();
})
|
Back to the widget index
|