[][src]Struct kas::widget::EditBox

pub struct EditBox<G: 'static> {
    pub guard: G,
    // some fields omitted
}

An editable, single-line text box.

This widget is intended for use with short input strings. Internally it uses a String, for which edits have O(n) cost.

Optionally, EditBox::multi_line mode can be activated (enabling line-wrapping and a larger vertical height). This mode is only recommended for short texts for performance reasons.

Fields

guard: G

The associated EditGuard implementation

Implementations

impl EditBox<EditVoid>[src]

pub fn new<S: ToString>(text: S) -> Self[src]

Construct an EditBox with the given inital text.

pub fn with_guard<G: EditGuard>(self, guard: G) -> EditBox<G>[src]

Set an EditGuard

Technically, this consumes self and reconstructs another EditBox with a different parameterisation.

This method calls EditGuard::edit after applying guard to self and discards any message emitted.

pub fn on_activate<F: Fn(&str) -> Option<M>, M>(
    self,
    f: F
) -> EditBox<EditActivate<F, M>>
[src]

Set a guard function, called on activation

The closure f is called when the EditBox is activated (when the "enter" key is pressed). Its result, if not None, is the event handler's response.

This method is a parametisation of EditBox::with_guard. Any guard previously assigned to the EditBox will be replaced.

pub fn on_afl<F: Fn(&str) -> Option<M>, M>(self, f: F) -> EditBox<EditAFL<F, M>>[src]

Set a guard function, called on activation and input-focus lost

The closure f is called when the EditBox is activated (when the "enter" key is pressed) and when keyboard focus is lost. Its result, if not None, is the event handler's response.

This method is a parametisation of EditBox::with_guard. Any guard previously assigned to the EditBox will be replaced.

pub fn on_edit<F: Fn(&str) -> Option<M>, M>(
    self,
    f: F
) -> EditBox<EditEdit<F, M>>
[src]

Set a guard function, called on edit

The closure f is called when the EditBox is edited by the user. Its result, if not None, is the event handler's response.

The closure f is also called initially (by this method) and on programmatic edits, however in these cases any results returned by f are discarded.

This method is a parametisation of EditBox::with_guard. Any guard previously assigned to the EditBox will be replaced.

impl<G> EditBox<G>[src]

pub fn editable(self, editable: bool) -> Self[src]

Set whether this EditBox is editable (inline)

pub fn is_editable(&self) -> bool[src]

Get whether this EditBox is editable

pub fn set_editable(&mut self, editable: bool)[src]

Set whether this EditBox is editable

pub fn multi_line(self, multi_line: bool) -> Self[src]

Set whether this EditBox shows multiple text lines

pub fn has_error(&self) -> bool[src]

Get whether the input state is erroneous

pub fn set_error_state(&mut self, error_state: bool)[src]

Set the error state

When true, the input field's background is drawn red.

Trait Implementations

impl<G: Clone + 'static> Clone for EditBox<G>[src]

impl<G> Debug for EditBox<G>[src]

impl<G: Default + 'static> Default for EditBox<G>[src]

impl<G: EditGuard + 'static> Handler for EditBox<G>[src]

type Msg = G::Msg

Type of message returned by this widget Read more

impl<G: EditGuard> HasStr for EditBox<G>[src]

impl<G: EditGuard> HasString for EditBox<G>[src]

impl<G: 'static> Layout for EditBox<G>[src]

impl<G: 'static> SendEvent for EditBox<G> where
    G: EditGuard
[src]

impl<G: 'static> Widget for EditBox<G> where
    G: EditGuard
[src]

impl<G: 'static> WidgetChildren for EditBox<G>[src]

impl<G: 'static> WidgetConfig for EditBox<G>[src]

impl<G: 'static> WidgetCore for EditBox<G>[src]

Auto Trait Implementations

impl<G> RefUnwindSafe for EditBox<G> where
    G: RefUnwindSafe

impl<G> Send for EditBox<G> where
    G: Send

impl<G> Sync for EditBox<G> where
    G: Sync

impl<G> Unpin for EditBox<G> where
    G: Unpin

impl<G> UnwindSafe for EditBox<G> where
    G: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.