Gtk.EntryCompletion
Description: Reference for Gtk.EntryCompletion

### Class

# GtkEntryCompletion

#### Description [src]

    final class Gtk.EntryCompletion : GObject.Object {
      /* No available fields */
    }

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

It implements the `GtkCellLayout` 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 `gtk_entry_completion_set_text_column()`), but this can be overridden with a custom match function (see `gtk_entry_completion_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 `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 `gtk_entry_set_completion()`.

`GtkEntryCompletion` uses a `GtkTreeModelFilter` model to represent the subset of the entire model that is currently matching. While the `GtkEntryCompletion` signals `GtkEntryCompletion::match-selected` and `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::apply-attributes)] will generally take the filter model as argument. As long as you are only calling `gtk_tree_model_get()`, this will make no difference to you. If for some reason, you need the original model, use `gtk_tree_model_filter_get_model()`. Don’t forget to use `gtk_tree_model_filter_convert_iter_to_child_iter()` to obtain a matching iter.

#### Hierarchy

#### Ancestors

- GObject

#### Implements

- GtkBuildable
- GtkCellLayout

#### Constructors

###### gtk_entry_completion_new

Creates a new `GtkEntryCompletion` object.

###### gtk_entry_completion_new_with_area

Creates a new `GtkEntryCompletion` object using the specified `area`.

#### Instance methods

###### gtk_entry_completion_complete

Requests a completion operation, or in other words a refiltering of the current list with completions, using the current key.

###### gtk_entry_completion_compute_prefix

Computes the common prefix that is shared by all rows in `completion` that start with `key`.

###### gtk_entry_completion_get_completion_prefix

Get the original text entered by the user that triggered the completion or `NULL` if there’s no completion ongoing.

###### gtk_entry_completion_get_entry

Gets the entry `completion` has been attached to.

###### gtk_entry_completion_get_inline_completion

Returns whether the common prefix of the possible completions should be automatically inserted in the entry.

###### gtk_entry_completion_get_inline_selection

Returns `TRUE` if inline-selection mode is turned on.

###### gtk_entry_completion_get_minimum_key_length

Returns the minimum key length as set for `completion`.

###### gtk_entry_completion_get_model

Returns the model the `GtkEntryCompletion` is using as data source.

###### gtk_entry_completion_get_popup_completion

Returns whether the completions should be presented in a popup window.

###### gtk_entry_completion_get_popup_set_width

Returns whether the completion popup window will be resized to the width of the entry.

###### gtk_entry_completion_get_popup_single_match

Returns whether the completion popup window will appear even if there is only a single match.

###### gtk_entry_completion_get_text_column

Returns the column in the model of `completion` to get strings from.

###### gtk_entry_completion_insert_prefix

Requests a prefix insertion.

###### gtk_entry_completion_set_inline_completion

Sets whether the common prefix of the possible completions should be automatically inserted in the entry.

###### gtk_entry_completion_set_inline_selection

Sets whether it is possible to cycle through the possible completions inside the entry.

###### gtk_entry_completion_set_match_func

Sets the match function for `completion` to be `func`.

###### gtk_entry_completion_set_minimum_key_length

Requires the length of the search key for `completion` to be at least `length`.

###### gtk_entry_completion_set_model

Sets the model for a `GtkEntryCompletion`.

###### gtk_entry_completion_set_popup_completion

Sets whether the completions should be presented in a popup window.

###### gtk_entry_completion_set_popup_set_width

Sets whether the completion popup window will be resized to be the same width as the entry.

###### gtk_entry_completion_set_popup_single_match

Sets whether the completion popup window will appear even if there is only a single match.

###### gtk_entry_completion_set_text_column

Convenience function for setting up the most used case of this code: a completion list with just strings.

##### Methods inherited from GObject (43)

Please see GObject for a full list of methods.

##### Methods inherited from GtkBuildable (1)

###### gtk_buildable_get_buildable_id

Gets the ID of the `buildable` object.

##### Methods inherited from GtkCellLayout (10)

###### gtk_cell_layout_add_attribute

Adds an attribute mapping to the list in `cell_layout`.

###### gtk_cell_layout_clear

Unsets all the mappings on all renderers on `cell_layout` and removes all renderers from `cell_layout`.

###### gtk_cell_layout_clear_attributes

Clears all existing attributes previously set with gtk_cell_layout_set_attributes().

###### gtk_cell_layout_get_area

Returns the underlying `GtkCellArea` which might be `cell_layout` if called on a `GtkCellArea` or might be `NULL` if no `GtkCellArea` is used by `cell_layout`.

###### gtk_cell_layout_get_cells

Returns the cell renderers which have been added to `cell_layout`.

###### gtk_cell_layout_pack_end

Adds the `cell` to the end of `cell_layout`. If `expand` is `FALSE`, then the `cell` is allocated no more space than it needs. Any unused space is divided evenly between cells for which `expand` is `TRUE`.

###### gtk_cell_layout_pack_start

Packs the `cell` into the beginning of `cell_layout`. If `expand` is `FALSE`, then the `cell` is allocated no more space than it needs. Any unused space is divided evenly between cells for which `expand` is `TRUE`.

###### gtk_cell_layout_reorder

Re-inserts `cell` at `position`.

###### gtk_cell_layout_set_attributes

Sets the attributes in the parameter list as the attributes of `cell_layout`.

###### gtk_cell_layout_set_cell_data_func

Sets the `GtkCellLayout`DataFunc to use for `cell_layout`.

#### Properties

###### Gtk.EntryCompletion:cell-area

The `GtkCellArea` used to layout cell renderers in the treeview column.

###### Gtk.EntryCompletion:inline-completion

Determines whether the common prefix of the possible completions should be inserted automatically in the entry.

###### Gtk.EntryCompletion:inline-selection

Determines whether the possible completions on the popup will appear in the entry as you navigate through them.

###### Gtk.EntryCompletion:minimum-key-length

No description available.

###### Gtk.EntryCompletion:model

No description available.

###### Gtk.EntryCompletion:popup-completion

Determines whether the possible completions should be shown in a popup window.

###### Gtk.EntryCompletion:popup-set-width

Determines whether the completions popup window will be resized to the width of the entry.

###### Gtk.EntryCompletion:popup-single-match

Determines whether the completions popup window will shown for a single possible completion.

###### Gtk.EntryCompletion:text-column

The column of the model containing the strings.

#### Signals

###### Gtk.EntryCompletion::cursor-on-match

Emitted when a match from the cursor is on a match of the list.

###### Gtk.EntryCompletion::insert-prefix

Emitted when the inline autocompletion is triggered.

###### Gtk.EntryCompletion::match-selected

Emitted when a match from the list is selected.

###### Gtk.EntryCompletion::no-matches

Emitted when the filter model has zero number of rows in completion_complete method.

##### Signals inherited from GObject (1)

###### GObject.Object::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.