pub struct SearchInput(/* private fields */);Expand description
Single-line entry of search text: the platform’s search field, with its
search icon and clear button. on_search is called
when the platform asks for a search, as its own apps search.
Implementations§
Source§impl SearchInput
impl SearchInput
pub fn new() -> SearchInput
pub fn value(self, value: impl IntoValue<String>) -> SearchInput
Sourcepub fn bind(self, signal: Signal<String>) -> SearchInput
pub fn bind(self, signal: Signal<String>) -> SearchInput
Two-way binding, Vue’s v-model.
Sourcepub fn placeholder(self, placeholder: impl IntoValue<String>) -> SearchInput
pub fn placeholder(self, placeholder: impl IntoValue<String>) -> SearchInput
Shown while it’s empty, in place of the platform’s own where it has one (AppKit, Qt). It names the field to assistive technology without a label.
pub fn enabled(self, enabled: impl IntoValue<bool>) -> SearchInput
Sourcepub fn on_input(self, handler: impl Fn(String) + 'static) -> SearchInput
pub fn on_input(self, handler: impl Fn(String) + 'static) -> SearchInput
Called on every edit with the new text, the clear button’s too.
Sourcepub fn on_key(
self,
key: impl Into<Shortcut>,
handler: impl Fn() + 'static,
) -> SearchInput
pub fn on_key( self, key: impl Into<Shortcut>, handler: impl Fn() + 'static, ) -> SearchInput
Called with the text when the platform asks for a search: as the
user types, after a pause where the platform waits for one (AppKit,
GTK, Qt) and at once where it doesn’t (WinUI); on Return; and when
the field is cleared. Not for text the app set.
Takes key before the field’s own use of it (the arrows, Return,
Escape; the suggestions’ still come first), and runs handler when
it’s pressed in the field.
pub fn on_search(self, handler: impl Fn(String) + 'static) -> SearchInput
Sourcepub fn search_on_return(self, on: impl IntoValue<bool>) -> SearchInput
pub fn search_on_return(self, on: impl IntoValue<bool>) -> SearchInput
Searches on Return (and when cleared), not as the user types: for searches that take a while, with each platform’s own setting for it.
Sourcepub fn suggestions(
self,
suggestions: impl IntoValue<Vec<Suggestion>>,
) -> SearchInput
pub fn suggestions( self, suggestions: impl IntoValue<Vec<Suggestion>>, ) -> SearchInput
What it suggests for its text, in a list under it as the platform shows a field’s suggestions; empty: none. The field keeps the keyboard: the arrows move through the list, Return picks one, and Escape hides it. The app sets it as the text changes.
Sourcepub fn on_suggestion(self, handler: impl Fn(usize) + 'static) -> SearchInput
pub fn on_suggestion(self, handler: impl Fn(usize) + 'static) -> SearchInput
Called with a suggestion’s index when the user picks it. The text is the app’s to set.
Sourcepub fn native(self, tweak: Tweak<SearchInput>) -> SearchInput
pub fn native(self, tweak: Tweak<SearchInput>) -> SearchInput
Raw platform settings, past the semantic ones: see Tweak. What
the platforms offer (recent searches on AppKit, GTK’s search delay,
Kirigami’s longer one, a header on WinUI) is each one’s own.
Trait Implementations§
Source§impl Default for SearchInput
impl Default for SearchInput
Source§fn default() -> SearchInput
fn default() -> SearchInput
Source§impl ElementBuilder for SearchInput
impl ElementBuilder for SearchInput
fn element(&mut self) -> &mut Element
Source§fn style(self, f: impl FnOnce(&mut Style)) -> Self
fn style(self, f: impl FnOnce(&mut Style)) -> Self
Source§fn style_with(self, f: impl Fn(&mut Style) + 'static) -> Self
fn style_with(self, f: impl Fn(&mut Style) + 'static) -> Self
f re-runs whenever the
signals it reads change, and must set every field it cares about.fn width(self, value: impl IntoValue<Length>) -> Self
fn height(self, value: impl IntoValue<Length>) -> Self
fn min_width(self, value: impl IntoValue<Length>) -> Self
fn min_height(self, value: impl IntoValue<Length>) -> Self
fn max_width(self, value: impl IntoValue<Length>) -> Self
fn max_height(self, value: impl IntoValue<Length>) -> Self
fn aspect_ratio(self, value: impl IntoValue<f32>) -> Self
fn padding(self, value: impl IntoValue<Length>) -> Self
fn padding_x(self, value: impl IntoValue<Length>) -> Self
fn padding_y(self, value: impl IntoValue<Length>) -> Self
fn padding_start(self, value: impl IntoValue<Length>) -> Self
fn padding_end(self, value: impl IntoValue<Length>) -> Self
fn padding_top(self, value: impl IntoValue<Length>) -> Self
fn padding_bottom(self, value: impl IntoValue<Length>) -> Self
fn margin(self, value: impl IntoValue<Length>) -> Self
fn margin_x(self, value: impl IntoValue<Length>) -> Self
fn margin_y(self, value: impl IntoValue<Length>) -> Self
fn margin_start(self, value: impl IntoValue<Length>) -> Self
fn margin_end(self, value: impl IntoValue<Length>) -> Self
fn margin_top(self, value: impl IntoValue<Length>) -> Self
fn margin_bottom(self, value: impl IntoValue<Length>) -> Self
fn grow(self, value: impl IntoValue<f32>) -> Self
fn shrink(self, value: impl IntoValue<f32>) -> Self
fn basis(self, value: impl IntoValue<Length>) -> Self
fn align_self(self, value: impl IntoValue<Align>) -> Self
Source§fn justify_self(self, value: impl IntoValue<Align>) -> Self
fn justify_self(self, value: impl IntoValue<Align>) -> Self
Source§fn top(self, value: impl IntoValue<Length>) -> Self
fn top(self, value: impl IntoValue<Length>) -> Self
absolute()).fn bottom(self, value: impl IntoValue<Length>) -> Self
Source§fn start(self, value: impl IntoValue<Length>) -> Self
fn start(self, value: impl IntoValue<Length>) -> Self
fn end(self, value: impl IntoValue<Length>) -> Self
fn grid_column(self, value: impl IntoValue<GridPlacement>) -> Self
fn grid_row(self, value: impl IntoValue<GridPlacement>) -> Self
fn direction(self, value: impl IntoValue<TextDirection>) -> Self
display the node had.fn size( self, width: impl IntoValue<Length>, height: impl IntoValue<Length>, ) -> Self
Source§fn tooltip(self, text: impl IntoValue<String>) -> Self
fn tooltip(self, text: impl IntoValue<String>) -> Self
entries, and built again whenever what it
reads changes, as Menu::children_with builds its entries.entries each time the platform opens it,
for a menu that depends on what’s selected or under the pointer at
that moment: a table row’s menu acting on the selection. What it
reads is read then, not followed.