Package: gtk
Class gtk:entry-completion
SuperclassesDocumented Subclasses
None
Direct SlotsDetails 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 entry, the gtk:entry-completion object 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 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 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 gtk:entry-completion function. In addition to regular completion matches, which will be inserted into the entry when they are selected, the gtk:entry-completion object 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. 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 object "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 the gtk:cell-layout-data-func callback or "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. Signal DetailsThe "action-activated" signallambda (widget index) :run-lastGets emitted when an action is activated.
The "cursor-on-match" signallambda (widget model iter) :run-lastGets 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 gtk:entry-completion-model function.
The "insert-prefix" signallambda (widget prefix) :run-lastGets 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 widget inserts only the part of the prefix up to the next '/'.
The "match-selected" signallambda (widget model iter) :run-lastGets 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 gtk:entry-completion-model function.
The "no-matches" signallambda (widget) :run-lastGets emitted when the entry completion is out of suggestions.
| Returned bySlot Access FunctionsInherited Slot Access FunctionsSee also |
2024-3-17