gtk.search_entry

Module for [SearchEntry] class

Types 3

[gtk.search_entry.SearchEntry] is an entry widget that has been tailored for use as a search entry.

The main API for interacting with a [gtk.search_entry.SearchEntry] as entry is the [gtk.editable.Editable] interface.

!An example GtkSearchEntry

It will show an inactive symbolic “find” icon when the search entry is empty, and a symbolic “clear” icon when there is text. Clicking on the “clear” icon will empty the search entry.

To make filtering appear more reactive, it is a good idea to not react to every change in the entry text immediately, but only after a short delay. To support this, [gtk.search_entry.SearchEntry] emits the signal@Gtk.SearchEntry::search-changed signal which can be used instead of the [gtk.editable.Editable.changed] signal.

The signal@Gtk.SearchEntry::previous-match, signal@Gtk.SearchEntry::next-match and signal@Gtk.SearchEntry::stop-search signals can be used to implement moving between search results and ending the search.

Often, [gtk.search_entry.SearchEntry] will be fed events by means of being placed inside a [gtk.search_bar.SearchBar]. If that is not the case, you can use [gtk.search_entry.SearchEntry.setKeyCaptureWidget] to let it capture key input from another widget.

[gtk.search_entry.SearchEntry] provides only minimal API and should be used with the [gtk.editable.Editable] API.

CSS Nodes

entry.search
╰── text

[gtk.search_entry.SearchEntry] has a single CSS node with name entry that carries a .search style class, and the text node is a child of that.

Accessibility

[gtk.search_entry.SearchEntry] uses the [gtk.types.AccessibleRole.SearchBox] role.

Methods
GType _gType() @property
SearchEntry self()Returns `this`, for use in `with` statements.
SearchEntryGidBuilder builder()Get builder for [gtk.search_entry.SearchEntry] Returns: New builder object
bool activatesDefault() @propertyGet `activatesDefault` property. Returns: Whether to activate the default widget when Enter is pressed.
void activatesDefault(bool propval) @propertySet `activatesDefault` property. Params: propval = Whether to activate the default widget when Enter is pressed.
gtk.types.InputHints inputHints() @propertyGet `inputHints` property. Returns: The hints about input for the [gtk.search_entry.SearchEntry] used to alter the behaviour of input methods.
void inputHints(gtk.types.InputHints propval) @propertySet `inputHints` property. Params: propval = The hints about input for the [gtk.search_entry.SearchEntry] used to alter the behaviour of input methods.
gtk.types.InputPurpose inputPurpose() @propertyGet `inputPurpose` property. Returns: The purpose for the [gtk.search_entry.SearchEntry] input used to alter the behaviour of input methods.
void inputPurpose(gtk.types.InputPurpose propval) @propertySet `inputPurpose` property. Params: propval = The purpose for the [gtk.search_entry.SearchEntry] input used to alter the behaviour of input methods.
string placeholderText() @propertyGet `placeholderText` property. Returns: The text that will be displayed in the [gtk.search_entry.SearchEntry] when it is empty and unfocused.
void placeholderText(string propval) @propertySet `placeholderText` property. Params: propval = The text that will be displayed in the [gtk.search_entry.SearchEntry] when it is empty and unfocused.
uint searchDelay() @propertyGet `searchDelay` property. Returns: The delay in milliseconds from last keypress to the search changed signal.
void searchDelay(uint propval) @propertySet `searchDelay` property. Params: propval = The delay in milliseconds from last keypress to the search changed signal.
gtk.types.InputHints getInputHints()Gets the input purpose for entry. Returns: The input hints
gtk.types.InputPurpose getInputPurpose()Gets the input purpose of entry. Returns: The input hints
gtk.widget.Widget getKeyCaptureWidget()Gets the widget that entry is capturing key events from. Returns: The key capture widget.
string getPlaceholderText()Gets the placeholder text associated with entry. Returns: The placeholder text.
uint getSearchDelay()Get the delay to be used between the last keypress and the `signalGtk.SearchEntry::search-changed` signal being emitted. Returns: a delay in milliseconds.
void setInputHints(gtk.types.InputHints hints)Sets the input hints for entry.
void setInputPurpose(gtk.types.InputPurpose purpose)Sets the input purpose of entry.
void setKeyCaptureWidget(gtk.widget.Widget widget = null)Sets widget as the widget that entry will capture key events from.
void setPlaceholderText(string text = null)Sets the placeholder text associated with entry.
void setSearchDelay(uint delay)Set the delay to be used between the last keypress and the `signalGtk.SearchEntry::search-changed` signal being emitted.
gulong connectActivate(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.search_entry.SearchEntry))) && Parameters!T.length < 2)Connect to `Activate` signal.
gulong connectNextMatch(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.search_entry.SearchEntry))) && Parameters!T.length < 2)Connect to `NextMatch` signal.
gulong connectPreviousMatch(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.search_entry.SearchEntry))) && Parameters!T.length < 2)Connect to `PreviousMatch` signal.
gulong connectSearchChanged(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.search_entry.SearchEntry))) && Parameters!T.length < 2)Connect to `SearchChanged` signal.
gulong connectSearchStarted(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.search_entry.SearchEntry))) && Parameters!T.length < 2)Connect to `SearchStarted` signal.
gulong connectStopSearch(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.search_entry.SearchEntry))) && Parameters!T.length < 2)Connect to `StopSearch` signal.
Constructors
this(void * ptr, Flag!"Take" take)
this()Creates a [gtk.searchentry.SearchEntry]. Returns: a new [gtk.searchentry.SearchEntry]
Methods
T activatesDefault(bool propval)Set `activatesDefault` property. Params: propval = Whether to activate the default widget when Enter is pressed. Returns: Builder instance for fluent chaining
T inputHints(gtk.types.InputHints propval)Set `inputHints` property. Params: propval = The hints about input for the [gtk.search_entry.SearchEntry] used to alter the behaviour of input methods. Returns: Builder instance for fluent chaining
T inputPurpose(gtk.types.InputPurpose propval)Set `inputPurpose` property. Params: propval = The purpose for the [gtk.search_entry.SearchEntry] input used to alter the behaviour of input methods. Returns: Builder instance for fluent chaining
T placeholderText(string propval)Set `placeholderText` property. Params: propval = The text that will be displayed in the [gtk.search_entry.SearchEntry] when it is empty and unfocused. Returns: Builder instance for fluent chaining
T searchDelay(uint propval)Set `searchDelay` property. Params: propval = The delay in milliseconds from last keypress to the search changed signal. Returns: Builder instance for fluent chaining

Fluent builder for [gtk.search_entry.SearchEntry]