pub struct ComboboxState {
pub area: Rect,
pub choice: ChoiceState<String>,
pub text: TextInputState,
pub focus: FocusFlag,
pub mouse: MouseFlags,
pub non_exhaustive: NonExhaustive,
}Fields§
§area: RectTotal area. read only. renewed with each render.
choice: ChoiceState<String>Core
text: TextInputStateText
focus: FocusFlagFocus flag. read+write
mouse: MouseFlagsMouse util.
non_exhaustive: NonExhaustiveImplementations§
Source§impl ComboboxState
impl ComboboxState
pub fn new() -> Self
pub fn named(name: &str) -> Self
Sourcepub fn is_popup_active(&self) -> bool
pub fn is_popup_active(&self) -> bool
Popup is active?
Sourcepub fn flip_popup_active(&mut self)
pub fn flip_popup_active(&mut self)
Flip the popup state.
Sourcepub fn set_popup_active(&mut self, active: bool) -> bool
pub fn set_popup_active(&mut self, active: bool) -> bool
Show the popup.
Sourcepub fn set_default_value(&mut self, default_value: Option<String>)
pub fn set_default_value(&mut self, default_value: Option<String>)
Set a default-value other than T::default()
The starting value will still be T::default() after this. You must call clear() to use this default.
This default will be overridden by a default set on the widget.
Sourcepub fn default_value(&self) -> &Option<String>
pub fn default_value(&self) -> &Option<String>
A default value.
Sourcepub fn set_value(&mut self, value: impl Into<String>) -> bool
pub fn set_value(&mut self, value: impl Into<String>) -> bool
Select the given value.
If the value doesn’t exist in the list or the list is empty the value will still be set, but selected will be None. The list will be empty before the first render, but the first thing render will do is set the list of values. This will adjust the selected index if possible. It’s still ok to set a value here that can not be represented. As long as there is no user interaction, the same value will be returned by value().
Sourcepub fn select(&mut self, select: usize) -> bool
pub fn select(&mut self, select: usize) -> bool
Select the value at index. This will set the value to the given index in the value-list. If the index is out of bounds or the value-list is empty it will set selected to None and leave the value as is. The list is empty before the first render so this may not work as expected.
The selected index is a best effort artefact, the main thing is the value itself.
Use of set_value() is preferred.
Sourcepub fn selected(&self) -> Option<usize>
pub fn selected(&self) -> Option<usize>
Returns the selected index or None if the value is not in the list or the list is empty.
You can still get the value set with set_value() though.
Sourcepub fn clear_offset(&mut self)
pub fn clear_offset(&mut self)
Scroll offset for the item list.
Sourcepub fn set_offset(&mut self, offset: usize) -> bool
pub fn set_offset(&mut self, offset: usize) -> bool
Scroll offset for the item list.
Sourcepub fn max_offset(&self) -> usize
pub fn max_offset(&self) -> usize
Scroll offset for the item list.
Sourcepub fn scroll_to_selected(&mut self) -> bool
pub fn scroll_to_selected(&mut self) -> bool
Scroll the item list to the selected value.
Source§impl ComboboxState
impl ComboboxState
Sourcepub fn select_by_char(&mut self, c: char) -> bool
pub fn select_by_char(&mut self, c: char) -> bool
Select by first character.
Sourcepub fn reverse_select_by_char(&mut self, c: char) -> bool
pub fn reverse_select_by_char(&mut self, c: char) -> bool
Select by first character. Reverse direction
Sourcepub fn move_to(&mut self, n: usize) -> ComboboxOutcome
pub fn move_to(&mut self, n: usize) -> ComboboxOutcome
Select at position
Sourcepub fn move_down(&mut self, n: usize) -> ComboboxOutcome
pub fn move_down(&mut self, n: usize) -> ComboboxOutcome
Select next entry.
Sourcepub fn move_up(&mut self, n: usize) -> ComboboxOutcome
pub fn move_up(&mut self, n: usize) -> ComboboxOutcome
Select prev entry.
Trait Implementations§
Source§impl Clone for ComboboxState
impl Clone for ComboboxState
Source§impl Debug for ComboboxState
impl Debug for ComboboxState
Source§impl Default for ComboboxState
impl Default for ComboboxState
Source§impl HandleEvent<Event, MouseOnly, ComboboxOutcome> for ComboboxState
impl HandleEvent<Event, MouseOnly, ComboboxOutcome> for ComboboxState
Source§impl HandleEvent<Event, Popup, ComboboxOutcome> for ComboboxState
impl HandleEvent<Event, Popup, ComboboxOutcome> for ComboboxState
Source§impl HasFocus for ComboboxState
impl HasFocus for ComboboxState
Source§fn build(&self, builder: &mut FocusBuilder)
fn build(&self, builder: &mut FocusBuilder)
Source§fn is_focused(&self) -> bool
fn is_focused(&self) -> bool
Source§fn lost_focus(&self) -> bool
fn lost_focus(&self) -> bool
Source§fn gained_focus(&self) -> bool
fn gained_focus(&self) -> bool
Source§impl HasScreenCursor for ComboboxState
impl HasScreenCursor for ComboboxState
Auto Trait Implementations§
impl !Freeze for ComboboxState
impl !RefUnwindSafe for ComboboxState
impl !Send for ComboboxState
impl !Sync for ComboboxState
impl Unpin for ComboboxState
impl !UnwindSafe for ComboboxState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more