Skip to main content

TextFieldScope

Struct TextFieldScope 

Source
pub struct TextFieldScope { /* private fields */ }
Expand description

A TextField and its builder.

Implementations§

Source§

impl TextFieldScope

Source

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.

Source

pub fn placeholder(self, placeholder: impl Into<String>) -> Self

Source

pub fn enabled(self, enabled: bool) -> Self

Source

pub fn multiline(self, multiline: bool) -> Self

Source

pub fn type_role(self, role: TypeRole) -> Self

The rung of the type ladder the field’s own text is set in.

Source

pub fn on_value_change(self, handler: impl FnMut(String) + 'static) -> Self

Source

pub fn on_submit(self, handler: impl FnMut(String) + 'static) -> Self

Source

pub fn on_focus_lost(self, handler: impl FnMut() + 'static) -> Self

Source

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.

Source§

impl TextFieldScope

Source

pub fn modifier(self, modifier: Modifier) -> Self

What sits around it. Compose’s modifier parameter.

Trait Implementations§

Source§

impl Drop for TextFieldScope

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.