[][src]Trait kas::widget::EditGuard

pub trait EditGuard: Sized {
    type Msg;
    fn activate(_: &mut EditBox<Self>) -> Option<Self::Msg> { ... }
fn focus_lost(_: &mut EditBox<Self>) -> Option<Self::Msg> { ... }
fn edit(_: &mut EditBox<Self>) -> Option<Self::Msg> { ... } }

A guard around an EditBox

When an EditBox receives input, it updates its contents as expected, then invokes a method of EditGuard. This method may update the EditBox and may return a message to be returned by the EditBox's event handler.

All methods on this trait are passed a reference to the EditBox as parameter. The EditGuard's state may be accessed via the EditBox::guard public field.

All methods have a default implementation which does nothing.

Associated Types

type Msg

Loading content...

Provided methods

fn activate(_: &mut EditBox<Self>) -> Option<Self::Msg>

Activation guard

This function is called when the widget is "activated", for example by the Enter/Return key for single-line edit boxes.

Note that activation events cannot edit the contents.

fn focus_lost(_: &mut EditBox<Self>) -> Option<Self::Msg>

Focus-lost guard

This function is called when the widget loses keyboard input focus.

fn edit(_: &mut EditBox<Self>) -> Option<Self::Msg>

Edit guard

This function is called on any edit of the contents.

Loading content...

Implementors

Loading content...