Web lists-archives.com

Re: How to customize GtkCellRendererCombo ?




Hi Stefan,

thank you for the nice idea.

I've tried the code, but it seems to produce two combo box columns instead of a single one, because renderer is pushed twice (original one is black, 2nd one is colored).

If I add this line before yours, that problem is fixed:
gtk_cell_layout_clear(GTK_CELL_LAYOUT(combo));

Unfortunately, this has other issue as well:
when you open combo box and select an item in it, selected item gets a handle to open its own sub-combo box. This sub-combo can get opened and selected item in it gets sub-sub-combo box.
Basically this process goes recursively.

I've tried to ensure that the initialization within on_tree_cell_combo_editing_start is called only once, but this doesn't seem to help ... :(

Regards,
  Miroslav

On 6.12.2015. 1:12, Stefan Salewski wrote:
On Sat, 2015-12-05 at 16:47 +0100, Miroslav Rajcic wrote:
I am trying to customize GtkCellRendererCombo so that the items in the
combo box have different colors.
Yes, that is not really easy.

Looking at

https://developer.gnome.org/gtk3/stable/GtkCellLayout.html#gtk-cell-layo
ut-set-cell-data-func

I saw

"This function is used instead of the standard attributes mapping for
setting the column value, and should set the value of cell_layout ’s
cell renderer(s) as appropriate."

So my guess was to replace your

//TOFIX

comment with this call:
				gtk_cell_layout_pack_start(GTK_CELL_LAYO
UT(combo), renderer, TRUE);

Seems to work.



_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list