On Tue, Mar 9, 2010 at 7:07 AM, Ardhan Madras <aj...@knac.com> wrote:
> Im using Glade 3.6.7 and GTK+ 2.18.7, build UI with Glade and save as 
> GtkBuilder format. I don't understand how GtkBuilder implements GtkComboBox's 
> TreeModel, in Glade i already add it's model, create a column and append some 
> entries. But i didn't see anything listed in that combo box (empty). I try to 
> manually create it's TreeModel in codes and apply:
>
> ...
> GtkTreeIter iter;
>
> GtkWidget *combo = (GtkWidget*) gtk_builder_get_object (builder, "Combo1");
> GtkListStore *store = gtk_list_store_new (1, G_TYPE_STRING);
> gtk_combo_box_set_model (GTK_COMBO_BOX (combo), GTK_TREE_MODEL (store));
> gtk_list_store_append (store, &iter);
> gtk_list_store_set (store, &iter, 0, "test", -1);
> ...
>
> I still have an empty GtkComboBox. Did i miss something here?

For a single column text store I believe there is a convenience function
to tell the combo box which column to pull text from.

But what you are missing is cell renderers (one will be implicitly created
by setting the text column for the combo box, iirc).

As the combo box implements GtkCellLayout, you can use that interface
to add renderers (but you should be able to add renderers in Glade as well,
did you hit the "Edit.." button in the toolbar with the combo box selected ?).

Cheers,
           -Tristan

>
>                  - Ardhan
>
>
>
> _____________________________________________________________
> Listen to KNAC, Hit the Home page and Tune In Live! ---> http://www.knac.com
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to