Package: gtk

Class gtk-entry-completion

Superclasses

gtk-buildable, gtk-cell-layout, g-object, common-lisp:standard-object, common-lisp:t

Documented Subclasses

None

Direct Slots

cell-area
The cell-area property of type gtk-cell-area (Read / Write / Construct)
The gtk-cell-area used to layout cell renderers in the treeview column. If no area is specified when creating the entry completion with the function gtk-entry-completion-new-with-area a horizontally oriented gtk-cell-area-box will be used.
inline-completion
The inline-completion property of type :boolean (Read / Write)
Determines whether the common prefix of the possible completions should be inserted automatically in the entry. Note that this requires the text-column property to be set, even if you are using a custom match function.
Default value: nil
inline-selection
The inline-selection property of type :boolean (Read / Write)
Determines whether the possible completions on the popup will appear in the entry as you navigate through them.
Default value: nil
minimum-key-length
The minimum-key-length property of type :int (Read / Write)
Minimum length of the search key in order to look up matches.
Allowed values: >= 0
Default value: 1
model
The model property of type gtk-tree-model (Read / Write)
The model to find matches in.
popup-completion
The popup-completion property of type :boolean (Read / Write)
Determines whether the possible completions should be shown in a popup window.
Default value: true
popup-set-width
The popup-set-width property of type :boolean (Read / Write)
Determines whether the completions popup window will be resized to the width of the entry.
Default value: true
popup-single-match
The popup-single-match property of type :boolean (Read / Write)
Determines whether the completions popup window will shown for a single possible completion. You probably want to set this to nil if you are using inline completion.
Default value: true
text-column
The text-column property of type :int (Read / Write)
The column of the model containing the strings. Note that the strings must be UTF-8.
Allowed values: >= -1
Default value: -1

Details

gtk-entry-completion is an auxiliary object to be used in conjunction with gtk-entry to provide the completion functionality. It implements the gtk-cell-layout interface, to allow the user to add extra cells to the gtk-tree-view with completion matches.

"Completion functionality" means that when the user modifies the text in the entry, gtk-entry-completion 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 the function gtk-entry-completion-text-column, but this can be overridden with a custom match function, see the function 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 "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 the function gtk-entry-set-completion.

In addition to regular completion matches, which will be inserted into the entry when they are selected, gtk-entry-completion also allows to display "actions" in the popup window. Their appearance is similar to menu items, to differentiate them clearly from completion strings. When an action is selected, the "action-activated" signal is emitted.

gtk-entry-completion uses a gtk-tree-model-filter model to represent the subset of the entire model that is currently matching. While the gtk-entry-completion signals "match-selected" and "cursor-on-match" take the original model and an iter pointing to that model as arguments, other callbacks and signals, such as GtkCellLayoutDataFuncs or "apply-attributes", will generally take the filter model as argument. As long as you are only calling the function gtk-tree-model-get, this will make no difference to you. If for some reason, you need the original model, use the function gtk-tree-model-filter-get-model. Do not forget to use the function gtk-tree-model-filter-convert-iter-to-child-iter to obtain a matching iter.

Signal Details

The "action-activated" signal
 lambda (widget index)    : Run Last      
Gets emitted when an action is activated.
widget
The object which received the signal.
index
The index of the activated action.
The "cursor-on-match" signal
 lambda (widget model iter)    : Run Last      
Gets emitted when a match from the cursor is on a match of the list. The default behaviour is to replace the contents of the entry with the contents of the text column in the row pointed to by iter. Note that model is the model that was passed to the function gtk-entry-completion-model.
widget
The object which received the signal.
model
The gtk-tree-model containing the matches.
iter
A gtk-tree-iter positioned at the selected match.
Returns
True if the signal has been handled.
The "insert-prefix" signal
 lambda (widget prefix)    : Run Last      
Gets emitted when the inline autocompletion is triggered. The default behaviour is to make the entry display the whole prefix and select the newly inserted part. Applications may connect to this signal in order to insert only a smaller part of the prefix into the entry - e. g. the entry used in the gtk-file-chooser inserts only the part of the prefix up to the next '/'.
widget
The object which received the signal.
prefix
The common prefix of all possible completions.
Returns
True if the signal has been handled.
The "match-selected" signal
 lambda (widget model  iter)    : Run Last      
Gets emitted when a match from the list is selected. The default behaviour is to replace the contents of the entry with the contents of the text column in the row pointed to by iter. Note that model is the model that was passed to the function gtk-entry-completion-model.
widget
The object which received the signal.
model
The gtk-tree-model containing the matches.
iter
A gtk-tree-iter positioned at the selected match.
Returns
True if the signal has been handled.
The "no-matches" signal
 lambda (widget)    : Run Last      
Gets emitted when the filter model has zero number of rows in completion_complete method. In other words when gtk-entry-completion is out of suggestions.
widget
The object which received the signal.
Since: 3.14
 

Slot Access Functions

Inherited Slot Access Functions

See also

2013-11-30