Struct druid::widget::ValueTextBox
source · pub struct ValueTextBox<T> { /* private fields */ }
Expand description
A TextBox
that uses a Formatter
to handle formatting and validation
of its data.
There are a number of ways to customize the behaviour of the text box
in relation to the provided Formatter
:
-
ValueTextBox::validate_while_editing
takes a flag that determines whether or not the textbox can display text that is not valid, while editing is in progress. (Text will still be validated when the user attempts to complete editing.) -
ValueTextBox::update_data_while_editing
takes a flag that determines whether the output value is updated during editing, when possible. -
ValueTextBox::delegate
allows you to provide some implementation of theValidationDelegate
trait, which receives a callback during editing; this can be used to report errors further back up the tree.
Implementations§
source§impl<T: Data> ValueTextBox<T>
impl<T: Data> ValueTextBox<T>
sourcepub fn delegate(self, delegate: impl ValidationDelegate + 'static) -> Self
pub fn delegate(self, delegate: impl ValidationDelegate + 'static) -> Self
Builder-style method to set an optional ValidationDelegate
on this
textbox.
sourcepub fn validate_while_editing(self, validate: bool) -> Self
pub fn validate_while_editing(self, validate: bool) -> Self
Builder-style method to set whether or not this text box validates its contents during editing.
If true
(the default) edits that fail validation
(Formatter::validate_partial_input
) will be rejected. If false
,
those edits will be accepted, and the text box will be updated.
sourcepub fn update_data_while_editing(self, flag: bool) -> Self
pub fn update_data_while_editing(self, flag: bool) -> Self
Builder-style method to set whether or not this text box updates the incoming data during editing.
If false
(the default) the data is only updated when editing completes.