Package: gtk

Class gtk:entry-completion

Superclasses

gtk:buildable, gtk:cell-layout, gobject: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 cell area used to layout cell renderers in the tree view column. If no area is specified when creating the entry completion with the gtk:entry-completion-new-with-area function a horizontally oriented gtk:cell-area-box object 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 text entry. Note that this requires the text-column property to be set, even if you are using a custom match function.
Default value: false
inline-selection
The inline-selection property of type :boolean (Read / Write)
Determines whether the possible completions on the popup will appear in the text entry as you navigate through them.
Default value: false
minimum-key-length
The minimum-key-length property of type :int (Read / Write)
The 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 false 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

The gtk:entry-completion object is an auxiliary object to be used in conjunction with the gtk:entry widget 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 widget with completion matches.

"Completion functionality" means that when the user modifies the text in the text entry, the gtk:entry-completion object checks which rows in the model match the current content of the text entry, and displays a list of matches. By default, the matching is done by comparing the text case-insensitively against the text column of the model, see the gtk:entry-completion-text-column function, but this can be overridden with a custom match function, see the gtk:entry-completion-set-match-func function.

When the user selects a completion, the content of the text entry is updated. By default, the content of the text 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 text 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 a text entry, use the gtk:entry-completion function.

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

Warning

The gtk:entry-completion implementation is deprecated since 4.10. This object will be removed in GTK 5.

Signal Details

The "cursor-on-match" signal
lambda (widget model iter)    :run-last      
widget
The gtk:entry-completion object which received the signal.
model
The gtk:tree-model object containing the matches.
iter
The gtk:tree-iter instance positioned at the selected match.
Returns
True if the signal has been handled.
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 text 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 gtk:entry-completion-model function.
The "insert-prefix" signal
lambda (widget prefix)    :run-last      
widget
The gtk:entry-completion object which received the signal.
prefix
The string with the common prefix of all possible completions.
Returns
True if the signal has been handled.
Gets emitted when the inline autocompletion is triggered. The default behaviour is to make the text 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 text entry, for example, the text entry used in the gtk:file-chooser widget inserts only the part of the prefix up to the next '/'.
The "match-selected" signal
lambda (widget model iter)    :run-last      
widget
The gtk:entry-completion object which received the signal.
model
The gtk:tree-model object containing the matches.
iter
The gtk:tree-iter instance positioned at the selected match.
Returns
True if the signal has been handled.
Gets emitted when a match from the list is selected. The default behaviour is to replace the contents of the text 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 gtk:entry-completion-model function.
The "no-matches" signal
lambda (widget)    :run-last      
widget
The gtk:entry-completion object which received the signal.
Gets emitted when the entry completion is out of suggestions.
 

Returned by

Slot Access Functions

Inherited Slot Access Functions

See also

2024-5-2