[Glade-users] GtkComboBox in Glade 3.63, GtkBuilder mode

On Sun, 2009-04-26 at 03:25 +0400, ???? ???????? wrote:

I wonder how to use GtkComboBox box with a glade-created GtkListStore.
I create GtkComboBox, create new model for it, fill model with several values of a single column(have tried 
different types). When I try to expand combobox control I see just small rectangle on top of the control. 
Am I missing something to get combo working properly?

You need to tell the combobox what column from the model you want to
show and how to show it. It is done with renderers (similar to the
treeview widget). Something like this for simple text from column #0:

GtkCellRenderer *renderer = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (mycombobox), renderer,
gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (mycombobox), renderer,
"text", 0);

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