GNOME Bugzilla – Bug 567141
Accelerator/Search support for combobox items
Last modified: 2018-05-02 14:39:54 UTC
I'd like to suggest a new feature for GtkComboBox, which is included in other toolkits and also browsers.
For long combo lists it's often boring to scroll the whole list before getting to an item. If items had accelerators or a kind of search, the user could use the keyboard to select the item.
I said "accelerator" but it's mandatory to use the first letters of the item, underlines would confuse the user.
1. When the user starts typing some keys the matching items in the combobox must be selected.
2. Pressing multiple keys is supported within a keyboard timeout (e.g. 1 second between each key) to improve the search pattern then select a more specific item.
3. API will expose a property for specifying which column of the model is going to be used for the search, though the cell renderer must be textual and visible to the user.
*** Bug 566950 has been marked as a duplicate of this bug. ***
Second this request.
Created attachment 143627 [details] [review]
Jump to the first row with the typed character
I went for a simple implementation that basically jumps to the first row beginning with the typed character, it works when the popup is open and when it's closed.
Note thatI didn't attempt to support non-Latin input since I don't have a keyboard to test that on.
pretty please, implement that! language/country combos in gnome-keyboard-properties really need that feature!
Just one more request (for more complex solution!): it would be cool to
"accumulate" search string. Let me illustrate. You have in your combo
First user presses 'c', selection goes to 'cde'. Then (soon enough!), user
presses 'f', selection does not go to 'fgh' but instead to 'cfg' (because f is
the second letter here. If there is a significant delay between 'c' and 'f' -
the selection goes to 'fgh'.
More like treeview interactive search.
*** Bug 603303 has been marked as a duplicate of this bug. ***
+1 for this request (because I'm the author of the duplicate above ;)
@Luca Bruno, the API must be like treeview interactive search, but not only for text-only model. The treeview search asks for an "equal_function" which is really nice when you want to use not-text model.
@Christian Dywan your solution needs more "visual feedback" like the popup menu that exists for treeview.
What about making a common GtkTreeSearch for GtkTreeView, GtkIconView and GtkComboBox? It will hold a search window and the entry, and some signals like start_interactive_search, search ecc. so that the views connect to these signals and moves through items accordingly to the iter passed in the signal:
treeview.search = gtk_tree_search_new(treeview.window, treeview.model);
gtk_signal_connect (treeview.search, "search", ...);
treesearch connects to key press of treeview
when user types a search window is shown
iter = treesearch.search_func(treesearch.model, gtk_entry_get_text(treesearch.entry), ...);
gtk_signal_emit (treesearch, "search", iter);
treeview moves selection to that iter...
Or something like that. I think extracting a search API with search window from the actual GtkTreeView interactive search can be done.
Created attachment 166028 [details] [review]
Jump to row beginning with the typed character #2
Updated patch. All characters being typed are compared to the rows. Hitting any control character such as arrows resets the search.
I'm not sure it's worth making that complex, with entries and interfaces. There is hardly space to place an entry, unlike a treeview since combos are usually fairly small. Although it seems something visual would be desirable.
In many places it doesn't have any special visual feedback, and it's fine (while a good visual feedback could be great). But anyway, please add this basic functionality to gtk (specially gtk3) ASAP since it is really needed. visual feedback can come afterwards.
As the patch is already written, why it is not applied?
*** Bug 436480 has been marked as a duplicate of this bug. ***
*** Bug 262687 has been marked as a duplicate of this bug. ***
*** Bug 643853 has been marked as a duplicate of this bug. ***
*** Bug 645240 has been marked as a duplicate of this bug. ***
-- GitLab Migration Automatic Message --
This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.
You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gtk/issues/310.