pub struct Select<'a, T: AsRef<str>> { /* private fields */ }Expand description
Choose one of a fixed list of options. current is an index into options; an index out of
range shows the placeholder.
Keyboard: Space, Enter or the arrows open it; the arrows, Home and End move; Enter or Space
chooses; Escape closes without choosing. The focus stays on the button while the list is
open. changed() on the response reports a choice.
Implementations§
Source§impl<'a, T: AsRef<str>> Select<'a, T>
impl<'a, T: AsRef<str>> Select<'a, T>
Sourcepub fn new(id: &'a str, options: &'a [T], current: &'a mut usize) -> Self
pub fn new(id: &'a str, options: &'a [T], current: &'a mut usize) -> Self
id is the automation id; options register as <id>.option.<n>.
Sourcepub fn width(self, width: f32) -> Self
pub fn width(self, width: f32) -> Self
Width of the button in points (default: 12 control heights).
Sourcepub fn label(self, label: &'a str) -> Self
pub fn label(self, label: &'a str) -> Self
The accessible name (what the select chooses: “Font size”).
Sourcepub fn placeholder(self, text: &'a str) -> Self
pub fn placeholder(self, text: &'a str) -> Self
Shown when current is out of range.
pub fn show(self, ui: &mut Ui) -> Response
Auto Trait Implementations§
impl<'a, T> !UnwindSafe for Select<'a, T>
impl<'a, T> Forget for Select<'a, T>
impl<'a, T> Freeze for Select<'a, T>
impl<'a, T> Move for Select<'a, T>
impl<'a, T> RefUnwindSafe for Select<'a, T>where
&'a [T]: RefUnwindSafe,
impl<'a, T> Send for Select<'a, T>
impl<'a, T> Sync for Select<'a, T>
impl<'a, T> Unpin for Select<'a, T>
impl<'a, T> UnsafeUnpin for Select<'a, T>where
&'a [T]: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more