pub struct TextBox {
pub text: String,
pub placeholder: String,
pub max_length: usize,
pub on_change: Option<String>,
pub on_submit: Option<String>,
pub caret: Option<usize>,
pub caret_visible: bool,
pub selection: (usize, usize),
pub first: usize,
}Expand description
A text box’s content and editing state, as drawn this frame. Built by
text_box (text, placeholder, max length, event names); the caret,
selection and horizontal scroll are filled in each frame by
TextBoxState::apply.
Fields§
§text: String§placeholder: StringShown greyed while the text is empty.
max_length: usizeLongest text allowed, in characters; 0 = unlimited.
on_change: Option<String>Event name for text changes (see TextBoxState::event_name).
on_submit: Option<String>Event name for Enter (see TextBoxState::event_name).
caret: Option<usize>Caret position in characters — Some while the box has focus.
caret_visible: boolDraw the caret this frame (it blinks).
selection: (usize, usize)Selected characters start..end (empty = none).
first: usizeFirst visible character (horizontal scroll).
Trait Implementations§
impl StructuralPartialEq for TextBox
Auto Trait Implementations§
impl Freeze for TextBox
impl RefUnwindSafe for TextBox
impl Send for TextBox
impl Sync for TextBox
impl Unpin for TextBox
impl UnsafeUnpin for TextBox
impl UnwindSafe for TextBox
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more