Expand description
Text input widget and properties.
The TextInput! widget is an text or parsed value editor that is styleable.
The example below defines 3 text inputs with the FieldStyle!.
use zng::prelude::*;
Stack! {
zng::text_input::style_fn = style_fn!(|_| zng::text_input::FieldStyle!());
children = ui_vec![
TextInput! {
txt = var(Txt::from("name"));
max_chars_count = 50;
},
TextInput! {
txt_parse = var(0u32);
zng::text_input::field_help = "help text";
// txt_parse_on_stop = true;
},
TextInput! {
txt = var_from("pass");
obscure_txt = true;
},
];
direction = StackDirection::top_to_bottom();
spacing = 5;
}The first input binds directly to a Txt read-write variable. The second field binds to an u32 read-write variable using the
txt_parse property. The third field obscures the text. The FieldStyle! adds data validation
adorners to the TextInput!, in the first field a char count is shown, in the second field the field_help
or parse errors are shown.
§Full API
See zng_wgt_text_input for the full widget API.
Structs§
- Default
Style WText input default style.- Field
Style WText input style that shows data notes, info, warn and error.- Search
Style WText input style for a search field.- Text
Input WSimple text editor widget.
Functions§
- data_
notes_ adorner_ fn PAdorner property used byFieldStyleto show data info, warn and error.- field_
help PText shown under aFieldStylewhen it has no data notes (no info, warn or error).- field_
style_ fn PExtends or replaces theFieldStyle!.- max_
chars_ count_ adorner_ fn PAdorner property used byFieldStyleto show the count/max indicator.- search_
style_ fn PExtends or replaces theSearchStyle!.- style_
fn PExtends or replaces the widget style.