pub struct TextFieldScope { /* private fields */ }Expand description
A TextField and its builder.
Implementations§
Source§impl TextFieldScope
impl TextFieldScope
Sourcepub fn text(self, text: impl Into<String>) -> Self
pub fn text(self, text: impl Into<String>) -> Self
The text the field starts with. Only the start: the field stays uncontrolled, so
what the user types is never written back, and a later value here changes nothing
on the field that is already there. To show other text, such as another document,
give the field a new identity with key, and the new field starts with this text.
pub fn placeholder(self, placeholder: impl Into<String>) -> Self
pub fn enabled(self, enabled: bool) -> Self
pub fn multiline(self, multiline: bool) -> Self
Sourcepub fn type_role(self, role: TypeRole) -> Self
pub fn type_role(self, role: TypeRole) -> Self
The rung of the type ladder the field’s own text is set in.
pub fn on_value_change(self, handler: impl FnMut(String) + 'static) -> Self
pub fn on_submit(self, handler: impl FnMut(String) + 'static) -> Self
pub fn on_focus_lost(self, handler: impl FnMut() + 'static) -> Self
Sourcepub fn on_key_down(self, handler: impl FnMut(KeyEvent) + 'static) -> Self
pub fn on_key_down(self, handler: impl FnMut(KeyEvent) + 'static) -> Self
Sees each key the field is pressed with; calling consume on the event keeps the
field from acting on it.
Trait Implementations§
Source§impl Drop for TextFieldScope
impl Drop for TextFieldScope
Auto Trait Implementations§
impl !RefUnwindSafe for TextFieldScope
impl !Send for TextFieldScope
impl !Sync for TextFieldScope
impl !UnwindSafe for TextFieldScope
impl Freeze for TextFieldScope
impl Unpin for TextFieldScope
impl UnsafeUnpin for TextFieldScope
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