Re: Elements not shown in treeview and combobox?



On Tuesday 04 January 2005 15:59, Diego Zuccato wrote:

>     (snip code)
>
> Seems to create the correct tree (the menu in the combo box is
> multi-level), but both the menu and the tree are "empty" (no characters
> drawn).
> IIRC the same code built a valid tree in 2.4 (I'm now using 2.6 to have
> a tree in the combobox). GtkDemo works ok and I can't see anything
> obvious in the code :-(

Try adding something like:

GtkCellRendererText *cell;

cell = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cb1), cell, FALSE);
gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (cb1), cell, "text", 0);

cell = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cb1), cell, FALSE);
gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (cb1), cell, "text", 1);

cell = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cb1), cell, FALSE);
gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (cb1), cell, "text", 2);

For the treeview, you'd need to create a GtkTreeViewColumn, append it to the 
tree view, and then pack cell renderers into the tree view column just like 
above.

Cheers
 -Tim



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