Struct kas_widgets::EditField [−][src]
Expand description
A text-edit field (single- or multi-line)
Usually one uses a derived type like EditBox
instead. This field does
not draw any background or borders, thus (1) there is no visual indication
that this is an edit field, and (2) there is no indication for disabled or
error states. The parent widget is responsible for this.
This widget is intended for use with short input strings. Internally it
uses a String
, for which edits have O(n)
cost.
Optionally, EditField::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
Set an EditGuard
Technically, this consumes self
and reconstructs another EditField
with a different parameterisation.
This method calls EditGuard::update
after applying guard
to self
and discards any message emitted.
Set a guard function, called on activation
The closure f
is called when the EditField
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 EditField::with_guard
. Any guard
previously assigned to the EditField
will be replaced.
Set a guard function, called on activation and input-focus lost
The closure f
is called when the EditField
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 EditField::with_guard
. Any guard
previously assigned to the EditField
will be replaced.
Set a guard function, called on edit
The closure f
is called when the EditField
is edited by the user.
Its result, if not None
, is the event handler’s response.
This method is a parametisation of EditField::with_guard
. Any guard
previously assigned to the EditField
will be replaced.
Set a guard function, called on update
The closure f
is called when the EditField
is updated (by the user or
programmatically). It is also called immediately by this method.
This method is a parametisation of EditField::with_guard
. Any guard
previously assigned to the EditField
will be replaced.
Get whether this EditField
is editable
Set whether this EditField
is editable
Set whether this EditField
shows multiple text lines
Get whether the widget currently has keyboard input focus
Set the error state
When true, the input field’s background is drawn red.
Trait Implementations
Get the number of child widgets
Get a reference to a child widget by index, or None
if the index is
out of bounds. Read more
Mutable variant of get Read more
Record first identifier Read more
Check whether id
is a descendant Read more
Find the child which is an ancestor of this id
, if any Read more
Find the leaf (lowest descendant) with this id
, if any Read more
Find the leaf (lowest descendant) with this id
, if any Read more
Walk through all widgets, calling f
once on each. Read more
Walk through all widgets, calling f
once on each. Read more
Get self as type Any
(mutable)
Get the name of the widget struct
Erase type
Erase type
Get whether the widget is disabled
Set the disabled state of a widget Read more
Set disabled state (chaining) Read more
Construct InputState
Read more
Auto Trait Implementations
impl<G> RefUnwindSafe for EditField<G> where
G: RefUnwindSafe,
impl<G> UnwindSafe for EditField<G> where
G: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn cast_trunc(self) -> T
pub fn cast_trunc(self) -> T
Cast to integer, truncating Read more
pub fn cast_nearest(self) -> T
pub fn cast_nearest(self) -> T
Cast to the nearest integer Read more
pub fn cast_floor(self) -> T
pub fn cast_floor(self) -> T
Cast the floor to an integer Read more
pub fn try_cast_trunc(self) -> Result<T, Error>
pub fn try_cast_trunc(self) -> Result<T, Error>
Try converting to integer with truncation Read more
pub fn try_cast_nearest(self) -> Result<T, Error>
pub fn try_cast_nearest(self) -> Result<T, Error>
Try converting to the nearest integer Read more
pub fn try_cast_floor(self) -> Result<T, Error>
pub fn try_cast_floor(self) -> Result<T, Error>
Try converting the floor to an integer Read more
pub fn try_cast_ceil(self) -> Result<T, Error>
pub fn try_cast_ceil(self) -> Result<T, Error>
Try convert the ceiling to an integer Read more