Skip to main content

FieldBuilder

Struct FieldBuilder 

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

A borderless text field inside the app’s own chrome. Start with field.

Implementations§

Source§

impl<'a> FieldBuilder<'a>

Source

pub fn config(self, c: TextFieldConfig) -> Self

Editing behaviour (text, search, password, multiline, max length).

Source

pub fn name(self, n: &'a str) -> Self

Accessible name (defaults to the placeholder).

Source

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

Grey hint while empty.

Source

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

Draw bullets instead of the text.

Source

pub fn text_rect(self, r: Rect) -> Self

Where the text runs, when it is inset inside the hit rect.

Source

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

Clip the text to its rect and scroll it with the caret (on by default; false lets it run past the rect).

Source

pub fn clip_to(self, r: Rect) -> Self

Clip paint and hits to r as well: the scroll viewport (or other overflow: hidden box) the field sits in. A field scrolled out of r keeps its text but is neither painted nor hit; one half out shows and hits only its visible part.

Source

pub fn font(self, px: f64, family: &'a str) -> Self

Font size and CSS family.

Source

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

Text and placeholder colours (CSS); the theme’s when unset.

Source

pub fn set(self, text: Option<&'a str>) -> Self

Replace the text this frame (Some("") clears it, undo included); the caret goes to the end.

Source

pub fn parent(self, p: impl Into<WidgetId>) -> Self

Nest the field under a container (a dialog scrim) for focus scoping.

Source

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

Register, draw, and feed the store.

Auto Trait Implementations§

§

impl<'a> Forget for FieldBuilder<'a>

§

impl<'a> Freeze for FieldBuilder<'a>

§

impl<'a> Move for FieldBuilder<'a>

§

impl<'a> RefUnwindSafe for FieldBuilder<'a>

§

impl<'a> Send for FieldBuilder<'a>

§

impl<'a> Sync for FieldBuilder<'a>

§

impl<'a> Unpin for FieldBuilder<'a>

§

impl<'a> UnsafeUnpin for FieldBuilder<'a>

§

impl<'a> UnwindSafe for FieldBuilder<'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.