[Glade-users] combobox question

John Delaney johndelaney at gmail.com
Thu Sep 23 13:35:55 EDT 2010


On Thu, Sep 23, 2010 at 6:20 PM, Arthur Shats <ashats at hotmail.com> wrote:
> I am not familiar with TreeModel. Does it mean I have to create a treeview
> widget in Glade instead of a combobox widget?

No. TreeModel is an interface that is implemented by TreeStore and
ListStore; you'll probably want to use the latter. You can create a
ListStore in Glade, populate it, create a TreeModelFilter, set its
child model as your ListStore, and then set the TreeModelFilter as the
model of your ComboBox. Personally I prefer to create my data
structures / models in code, though.

> Also, in my other combo box I have items that represent countries, so each
> item has a country code and its name beside it, like this:
> AG Argentina
> AU Austria
> BR Brazil
> FR France
> Of course, when item is selected I want to display the country name in the
> box, without the country code. I have a feeling I need to use TreeModel for
> this as well, right? No idea how to do this. Any hints/examples will be
> appreciated.

By using more than one cell renderer, perhaps?


More information about the Glade-users mailing list