Tristan Van Berkom
Fri, 12 Mar 2010 22:16:16 -0800
On Sat, Mar 13, 2010 at 1:10 AM, Ardhan Madras <aj...@knac.com> wrote: > From: Tristan Van Berkom <t...@gnome.org> > To: aj...@knac.com > Cc: gtk-app-devel-list@gnome.org > Subject: Re: Glade3: Setting TreeModel in GtkComboBox > Date: Tue, 9 Mar 2010 10:13:59 -0500 > >> 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 >> ?). > > Ahh.., i use the right panel to modify the combo box, when I used the > 'Edit..' button, i see a 'Hierarchy' tab to costumize it's cell-renderer. > That's I'm looking for, the combo box is now display it's entries with > GtkBuilder. > >> But what you are missing is cell renderers (one will be implicitly >> created by setting the text column for the combo box, iirc). > > For manually creating a combo box in code, i still use > gtk_combo_box_new_text() API, i have no success when writing combo box with > GtkTreeModel API. Such this previous code: > > ... > 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); > ... > > How to create a column, a cell renderer and apply them into the combo-box?
You dont use GtkTreeColumn, those are particular to GtkTreeView.
You can add renderers to the combo by way of the GtkCellLayout interface
which the combo box implements.
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