Class

Gtk.SearchEntry

Description [src]

final class Gtk.SearchEntry : Gtk.Widget {
  /* No available fields */
}

GtkSearchEntry is an entry widget that has been tailored for use as a search entry.

The main API for interacting with a GtkSearchEntry as entry is the GtkEditable 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, GtkSearchEntry emits the GtkSearchEntry::search-changed signal which can be used instead of the GtkEditable::changed signal.

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

Often, GtkSearchEntry will be fed events by means of being placed inside a GtkSearchBar. If that is not the case, you can use gtk_search_entry_set_key_capture_widget() to let it capture key input from another widget.

CSS Nodes

entry.search
╰── text

GtkSearchEntry has a single CSS node with name entry that carries a .sarch style class, and the text node is a child of that.

Accessibility

GtkSearchEntry uses the GTK_ACCESSIBLE_ROLE_SEARCH_BOX role.

Ancestors

Constructors

gtk_search_entry_new

Creates a GtkSearchEntry.

Signals

Gtk.SearchEntry::activate

Emitted when the entry is activated.

Gtk.SearchEntry::next-match

Emitted when the user initiates a move to the next match for the current search string.

Gtk.SearchEntry::previous-match

Emitted when the user initiates a move to the previous match for the current search string.

Gtk.SearchEntry::search-changed

Emitted with a short delay of 150 milliseconds after the last change to the entry text.

Gtk.SearchEntry::search-started

Emitted when the user initiated a search on the entry.

Gtk.SearchEntry::stop-search

Emitted when the user stops a search via keyboard input.