pub struct Combobox { /* private fields */ }Expand description
A Select you can type into.
It owns the query and whether the menu is open. Which option holds is the caller’s answer, so escape puts the query back to it and reports nothing.
Implementations§
Source§impl Combobox
impl Combobox
pub fn new( ident: impl Into<Ident>, window: &mut Window, cx: &mut Context<'_, Self>, ) -> Self
pub fn options(self, options: impl IntoIterator<Item = SelectOption>) -> Self
pub fn selected(self, id: impl Into<SharedString>) -> Self
Sourcepub fn name(self, name: impl Into<SharedString>) -> Self
pub fn name(self, name: impl Into<SharedString>) -> Self
Names both the combobox and its editable query target.
pub fn set_name( &mut self, name: impl Into<SharedString>, cx: &mut Context<'_, Self>, )
pub fn placeholder(self, placeholder: impl Into<SharedString>) -> Self
pub fn invalid(self, invalid: bool) -> Self
Sourcepub fn allow_custom(self, allow_custom: bool) -> Self
pub fn allow_custom(self, allow_custom: bool) -> Self
Whether a query nothing answers may be reported as a new value.
With it off the combobox reports nothing at all for such a query, and the list says that this is a closed set rather than drawing an empty list that looks like a list with nothing in it.
pub fn set_options( &mut self, options: Vec<SelectOption>, cx: &mut Context<'_, Self>, )
Sourcepub fn set_selected(
&mut self,
id: Option<SharedString>,
cx: &mut Context<'_, Self>,
)
pub fn set_selected( &mut self, id: Option<SharedString>, cx: &mut Context<'_, Self>, )
Replaces the choice from the host side, and puts its label back in the field so the query and the answer agree again.
pub fn set_query( &mut self, text: impl Into<SharedString>, cx: &mut Context<'_, Self>, )
pub fn selected_id(&self) -> Option<&SharedString>
pub fn selected_option(&self) -> Option<&SelectOption>
pub fn is_open(&self) -> bool
pub fn query_text(&self, cx: &App) -> SharedString
pub fn query_input(&self) -> &Entity<TextInput>
pub fn set_disabled(&mut self, disabled: bool, cx: &mut Context<'_, Self>)
pub fn open(&mut self, cx: &mut Context<'_, Self>)
pub fn toggle(&mut self, window: &mut Window, cx: &mut Context<'_, Self>)
Trait Implementations§
impl EventEmitter<ComboboxEvent> for Combobox
Source§impl Focusable for Combobox
impl Focusable for Combobox
Source§fn focus_handle(&self, cx: &App) -> FocusHandle
fn focus_handle(&self, cx: &App) -> FocusHandle
Returns the focus handle associated with this view.
Auto Trait Implementations§
impl !RefUnwindSafe for Combobox
impl !Send for Combobox
impl !Sync for Combobox
impl !UnwindSafe for Combobox
impl Freeze for Combobox
impl Unpin for Combobox
impl UnsafeUnpin for Combobox
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
Converts
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> ⓘ
Converts
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