[Glade-users] GtkComboBox question.



On Mon, 16 Feb 2009 22:36:44 -0500
Steve <zephod at cfl.rr.com> wrote:


---- John Coppens <john at jcoppens.com> wrote: 
On Mon, 16 Feb 2009 16:57:01 -0500
Steve Blackwell <zephod at cfl.rr.com> wrote:

Carlos Pereira says that "It seems that comboboxes made with glade
are not created with gtk_combo_box_new_text()"

I'm suspecting you refer to those 'made' in Glade-3? In that case,
Glade 3 simply _specifies_ a GtkComboBox, it doesn't say which type.

Yes, I'm talking about Glade-3.

Don't think I'm an expert, I'm just starting with Glade-3, and until now,
not entirely enjoying it yet, ;=)
 
Still, it  is not very difficult to modify them, and add a simple
GtkListStore with just one column to obtain the same funcionality.

I'm a n00b at gtk programming so I need a little hand holding if you
could. I can create a GtkListStore and add data to it but how do I
associate the store with the combobox? Also, once this has been done,
how do I retrieve the data in the store given the widget id of the
combobox? 

Well, assigning the ListStore to the ComboBox is easy with

gtk_combo_box_set_model

Assuming you made a one column ListStore, that's all there is to it.

Then afterward, you can use the selection of the model
(gtk_tree_model_get_selection) to get at the item selected.

It's not as easy as the ComboBoxText, but it does give you a better
control on what happening.

John




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]