Struct finestra::TextField

source ·
pub struct TextField<State> { /* private fields */ }
Expand description

A text field is a view that the user can enter text into.

Implementations§

source§

impl<State> TextField<State>

source

pub fn new(text: impl Into<StateOrRaw<String>>) -> Self

Creates a new TextField with an associated string that contains an initial value. If the value is a TextValue, this value will be updated if the text changes.

source

pub fn set_on_change( &mut self, action: impl Fn(&mut State, String, Window) + 'static )

Get notified when the text is changed.

source

pub fn with_on_change( self, action: impl Fn(&mut State, String, Window) + 'static ) -> Self

Get notified when the text is changed.

source

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

Set the placeholder of the field, which is displayed when the field is empty (the user has no text entered (yet)).

source

pub fn set_placeholder(&mut self, placeholder: impl Into<StateOrRaw<String>>)

Set the placeholder of the field, which is displayed when the field is empty (the user has no text entered (yet)).

Trait Implementations§

source§

impl<Delegate, State> From<TextField<State>> for Box<dyn View<Delegate, State>>
where Delegate: AppDelegate<State> + 'static, State: 'static,

source§

fn from(value: TextField<State>) -> Self

Converts to this type from the input type.
source§

impl<Delegate, State> View<Delegate, State> for TextField<State>
where Delegate: 'static + AppDelegate<State>, State: 'static,

Auto Trait Implementations§

§

impl<State> !RefUnwindSafe for TextField<State>

§

impl<State> !Send for TextField<State>

§

impl<State> !Sync for TextField<State>

§

impl<State> Unpin for TextField<State>

§

impl<State> !UnwindSafe for TextField<State>

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> BaseViewExt for T
where T: BaseView,

source§

fn set_tooltip(&mut self, tooltip: impl Into<StateOrRaw<String>>)

Set the tooltip of the view, which is text that is commonly displayed when hovering over a component (such as a button). This is used to provide the user with more context, or to let them know what the action will do.
source§

fn with_tooltip(self, tooltip: impl Into<StateOrRaw<String>>) -> T

Set the tooltip of the view, which is text that is commonly displayed when hovering over a component (such as a button). This is used to provide the user with more context, or to let them know what the action will do.
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>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.