pub struct RadioGroup { /* private fields */ }Expand description
Radio buttons, one for each of its options, to choose one from:
NSButtons of the radio type, RadioButtons, gtk::CheckButtons in a
group, QQC2.RadioButtons. Down a column, as each platform stacks
them. Its label is its accessible name; it isn’t drawn, so put a Text
above it.
Unlike a Select, a radio group can have none chosen, as on every
platform: until the user picks one, if selected says None or an
index past the options. The user can’t go back to none.
let size = signal(Some(1));
RadioGroup::new("Size").options(["Small", "Medium", "Large"]).bind(size)Implementations§
Source§impl RadioGroup
impl RadioGroup
pub fn new(label: impl IntoValue<String>) -> RadioGroup
Sourcepub fn label(self, label: impl IntoValue<String>) -> RadioGroup
pub fn label(self, label: impl IntoValue<String>) -> RadioGroup
Its label: the accessible name, which new takes. In view!,
<RadioGroup label="…"/>.
Sourcepub fn options(self, options: impl IntoValue<Vec<String>>) -> RadioGroup
pub fn options(self, options: impl IntoValue<Vec<String>>) -> RadioGroup
The options, in order: a list of strings, or a signal or closure giving one.
Sourcepub fn selected(self, index: impl IntoValue<Option<usize>>) -> RadioGroup
pub fn selected(self, index: impl IntoValue<Option<usize>>) -> RadioGroup
The index of the chosen option, None for none.
pub fn enabled(self, enabled: impl IntoValue<bool>) -> RadioGroup
Sourcepub fn native(self, tweak: Tweak<RadioGroup>) -> RadioGroup
pub fn native(self, tweak: Tweak<RadioGroup>) -> RadioGroup
Raw platform settings: see Tweak. The tweak gets the group’s
container (an NSStackView, the RadioButtons, a gtk::Box, a
QML ColumnLayout), which holds the buttons.
Sourcepub fn on_change(self, handler: impl Fn(usize) + 'static) -> RadioGroup
pub fn on_change(self, handler: impl Fn(usize) + 'static) -> RadioGroup
Called with the option’s index when the user chooses one.
Trait Implementations§
Source§impl ElementBuilder for RadioGroup
impl ElementBuilder for RadioGroup
fn element(&mut self) -> &mut Element
Source§fn style(self, f: impl FnOnce(&mut Style)) -> Self
fn style(self, f: impl FnOnce(&mut Style)) -> Self
Source§fn style_with(self, f: impl Fn(&mut Style) + 'static) -> Self
fn style_with(self, f: impl Fn(&mut Style) + 'static) -> Self
f re-runs whenever the
signals it reads change, and must set every field it cares about.fn width(self, value: impl IntoValue<Length>) -> Self
fn height(self, value: impl IntoValue<Length>) -> Self
fn min_width(self, value: impl IntoValue<Length>) -> Self
fn min_height(self, value: impl IntoValue<Length>) -> Self
fn max_width(self, value: impl IntoValue<Length>) -> Self
fn max_height(self, value: impl IntoValue<Length>) -> Self
fn aspect_ratio(self, value: impl IntoValue<f32>) -> Self
fn padding(self, value: impl IntoValue<Length>) -> Self
fn padding_x(self, value: impl IntoValue<Length>) -> Self
fn padding_y(self, value: impl IntoValue<Length>) -> Self
fn padding_start(self, value: impl IntoValue<Length>) -> Self
fn padding_end(self, value: impl IntoValue<Length>) -> Self
fn padding_top(self, value: impl IntoValue<Length>) -> Self
fn padding_bottom(self, value: impl IntoValue<Length>) -> Self
fn margin(self, value: impl IntoValue<Length>) -> Self
fn margin_x(self, value: impl IntoValue<Length>) -> Self
fn margin_y(self, value: impl IntoValue<Length>) -> Self
fn margin_start(self, value: impl IntoValue<Length>) -> Self
fn margin_end(self, value: impl IntoValue<Length>) -> Self
fn margin_top(self, value: impl IntoValue<Length>) -> Self
fn margin_bottom(self, value: impl IntoValue<Length>) -> Self
fn grow(self, value: impl IntoValue<f32>) -> Self
fn shrink(self, value: impl IntoValue<f32>) -> Self
fn basis(self, value: impl IntoValue<Length>) -> Self
fn align_self(self, value: impl IntoValue<Align>) -> Self
Source§fn justify_self(self, value: impl IntoValue<Align>) -> Self
fn justify_self(self, value: impl IntoValue<Align>) -> Self
Source§fn top(self, value: impl IntoValue<Length>) -> Self
fn top(self, value: impl IntoValue<Length>) -> Self
absolute()).fn bottom(self, value: impl IntoValue<Length>) -> Self
Source§fn start(self, value: impl IntoValue<Length>) -> Self
fn start(self, value: impl IntoValue<Length>) -> Self
fn end(self, value: impl IntoValue<Length>) -> Self
fn grid_column(self, value: impl IntoValue<GridPlacement>) -> Self
fn grid_row(self, value: impl IntoValue<GridPlacement>) -> Self
fn direction(self, value: impl IntoValue<TextDirection>) -> Self
display the node had.fn size( self, width: impl IntoValue<Length>, height: impl IntoValue<Length>, ) -> Self
Source§fn tooltip(self, text: impl IntoValue<String>) -> Self
fn tooltip(self, text: impl IntoValue<String>) -> Self
entries, and built again whenever what it
reads changes, as Menu::children_with builds its entries.entries each time the platform opens it,
for a menu that depends on what’s selected or under the pointer at
that moment: a table row’s menu acting on the selection. What it
reads is read then, not followed.