GtkDropDown - Add sublist


I searched everywhere but I couldn’t find an example about using GtkDropDown to show sublist.
By sublist, I mean like with GtkComboBox using gtk_tree_store_append (store, child, parent).

Is this possible ? I thought maybe with GtkTreeListModel but I have absolutely no idea if GtkDropDown support displaying sublist or if I have to construct I-don’t-know-what myself, etc…


No one ? Even a hint would be really helpful. :confused:


I don’t think anybody has tried.

You could check if you can use a GtkTreeListModel as the model, and GtkTreeExpander as the widget in the factory you pass to the GtkDropDown, and see what happens.

In general, piling complexity inside a GtkDropDown is not a great plan, just like piling complexity inside GtkComboBox; sub-lists inside GtkComboBox were never really well supported, and it was more of an accident.

Haha, I tried as you told me and here is the result:

Then, may I ask, from the gnome HIG point of view, how it should be done ?
Let’s say, for example, we have the typical case of Country/City.
With sublist, the user can select the country and then a city from the selected country.
But now, since we cannot do this anymore …?

Thank you

I’d recommend using a search approach, with the results inside a drop down, similarly to how search for a location is implemented in applications such as Clocks and Weather.

If you know the amount of levels, like Country / City, then you can separate the selection into separate drop downs, and keep each drop down to a single level.

In the example above, it seems you’re browsing through interfaces; in that case you really want to have a list with all the the interfaces always visible inside something like a side bar.

The main point is that visually scanning through a long list of things isn’t helpful, especially if you have to find something through multiple levels in a scrollable thing that may or may not disappear as a pop up.

Hmmm I see, I will try to do as you said, thanks again :pray:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.