EntryCompletion


Object Hierarchy:

Object hierarchy for EntryCompletion

Description:

[ CCode ( type_id = "gtk_entry_completion_get_type ()" ) ]
public class EntryCompletion : Object, Buildable, CellLayout

`GtkEntryCompletion` is an auxiliary object to provide completion functionality for `GtkEntry`.

It implements the [iface@Gtk.CellLayout] interface, to allow the user to add extra cells to the `GtkTreeView` with completion matches.

“Completion functionality” means that when the user modifies the text in the entry, `GtkEntryCompletion` checks which rows in the model match the current content of the entry, and displays a list of matches. By default, the matching is done by comparing the entry text case-insensitively against the text column of the model (see [method@Gtk.EntryCompletion.set_text_column]), but this can be overridden with a custom match function (see [method@Gtk.EntryCompletion.set_match_func]).

When the user selects a completion, the content of the entry is updated. By default, the content of the entry is replaced by the text column of the model, but this can be overridden by connecting to the [signal@Gtk.EntryCompletion:GtkEntryCompletion:match-selected] signal and updating the entry in the signal handler. Note that you should return true from the signal handler to suppress the default behaviour.

To add completion functionality to an entry, use [method@Gtk.Entry.set_completion].

`GtkEntryCompletion` uses a [class@Gtk.TreeModelFilter] model to represent the subset of the entire model that is currently matching. While the `GtkEntryCompletion` signals [signal@Gtk.EntryCompletion:GtkEntryCompletion:match-selected] and [signal@Gtk.EntryCompletion: GtkEntryCompletion:cursor-on-match] take the original model and an iter pointing to that model as arguments, other callbacks and signals (such as `GtkCellLayoutDataFunc` or [signal@Gtk.CellArea:GtkEntryCompletion:apply-attributess)] will generally take the filter model as argument. As long as you are only calling [method@Gtk.TreeModel.get], this will make no difference to you. If for some reason, you need the original model, use [method@Gtk.TreeModelFilter.get_model]. Don’t forget to use [ method@Gtk.TreeModelFilter.convert_iter_to_child_iter] to obtain a matching iter.


Namespace: Gtk
Package: gtk4

Content:

Properties:

Creation methods:

Methods:

Signals:

Inherited Members: