Gtk.EntryCompletion
const Gtk = imports.gi.Gtk; let entry_completion = new Gtk.EntryCompletion({ cell_area: value, inline_completion: value, inline_selection: value, minimum_key_length: value, model: value, popup_completion: value, popup_set_width: value, popup_single_match: value, text_column: value, });
Gtk.EntryCompletion is an auxiliary object to be used in conjunction with Gtk.Entry to provide the completion functionality. It implements the Gtk.CellLayout interface, to allow the user to add extra cells to the Gtk.TreeView with completion matches.
"Completion functionality" means that when the user modifies the text in the entry, Gtk.EntryCompletion 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.set_text_column), but this can be overridden with a custom match function (see Gtk.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 Gtk.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.prototype.set_completion.
In addition to regular completion matches, which will be inserted into the entry when they are selected, Gtk.EntryCompletion also allows to display "actions" in the popup window. Their appearance is similar to menuitems, to differentiate them clearly from completion strings. When an action is selected, the Gtk.action-activated signal is emitted.
GtkEntryCompletion uses a Gtk.TreeModelFilter model to represent the subset of the entire model that is currently matching. While the GtkEntryCompletion signals Gtk.match-selected and Gtk.cursor-on-match take the original model and an iter pointing to that model as arguments, other callbacks and signals (such as #GtkCellLayoutDataFuncs or Gtk.CellArea::apply-attributes) will generally take the filter model as argument. As long as you are only calling Gtk.get, this will make no difference to you. If for some reason, you need the original model, use Gtk.get_model. Don't forget to use Gtk.convert_iter_to_child_iter to obtain a matching iter.
Hierarchy
-
GObject.Object
- Gtk.EntryCompletion
Methods
- Gtk.EntryCompletion.prototype.complete
- Gtk.EntryCompletion.prototype.compute_prefix
- Gtk.EntryCompletion.prototype.delete_action
- Gtk.EntryCompletion.prototype.get_completion_prefix
- Gtk.EntryCompletion.prototype.get_entry
- Gtk.EntryCompletion.prototype.get_inline_completion
- Gtk.EntryCompletion.prototype.get_inline_selection
- Gtk.EntryCompletion.prototype.get_minimum_key_length
- Gtk.EntryCompletion.prototype.get_model
- Gtk.EntryCompletion.prototype.get_popup_completion
- Gtk.EntryCompletion.prototype.get_popup_set_width
- Gtk.EntryCompletion.prototype.get_popup_single_match
- Gtk.EntryCompletion.prototype.get_text_column
- Gtk.EntryCompletion.prototype.insert_action_markup
- Gtk.EntryCompletion.prototype.insert_action_text
- Gtk.EntryCompletion.prototype.insert_prefix
- Gtk.EntryCompletion.prototype.set_inline_completion
- Gtk.EntryCompletion.prototype.set_inline_selection
- Gtk.EntryCompletion.prototype.set_match_func
- Gtk.EntryCompletion.prototype.set_minimum_key_length
- Gtk.EntryCompletion.prototype.set_model
- Gtk.EntryCompletion.prototype.set_popup_completion
- Gtk.EntryCompletion.prototype.set_popup_set_width
- Gtk.EntryCompletion.prototype.set_popup_single_match
- Gtk.EntryCompletion.prototype.set_text_column