Skip to main content

InputBuilder

Struct InputBuilder 

Source
pub struct InputBuilder<'a> { /* private fields */ }
Expand description

Single-line editable text field. Start with input.

The framework’s text store edits it: caret, selection (drag, double and triple click, Shift+arrows, select all), clipboard, IME composition with the candidate window at the caret, and undo / redo (Ctrl+Z, Ctrl+Shift+Z or Ctrl+Y; typing undoes a word at a time). The bound String is two-way: a user edit is written back to it (changed), and a value the app sets is pushed into the field, which drops its undo history the way input.value = .. does. Enter reports TextIntent::Submitted.

Implementations§

Source§

impl<'a> InputBuilder<'a>

Source

pub fn placeholder(self, p: &'a str) -> Self

Grey hint shown while empty. Also the accessible name without .label.

Source

pub fn label(self, l: &'a str) -> Self

Accessible name.

Source

pub fn kind(self, k: InputType) -> Self

Field kind (text, number, search, password).

Source

pub fn password(self) -> Self

Masked password field (copy and cut are refused).

Source

pub fn max_len(self, n: usize) -> Self

Most chars the field takes, like maxlength.

Source

pub fn disabled(self, on: bool) -> Self

Disabled colours; not focusable or editable.

Source

pub fn build<'c, C: ContentCx<'c>>(self, cx: &mut C) -> Response

Register, sync the value, and draw.

Auto Trait Implementations§

§

impl<'a> !UnwindSafe for InputBuilder<'a>

§

impl<'a> Forget for InputBuilder<'a>

§

impl<'a> Freeze for InputBuilder<'a>

§

impl<'a> RefUnwindSafe for InputBuilder<'a>

§

impl<'a> Send for InputBuilder<'a>

§

impl<'a> Sync for InputBuilder<'a>

§

impl<'a> Unpin for InputBuilder<'a>

§

impl<'a> UnsafeUnpin for InputBuilder<'a>

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.