Re: [Vala] Gtk.TreeView + Cellrender + text different colors ???
- From: Flavio Danesse <fdanesse gmail com>
- To: Michael Gratton <mike vee net>
- Cc: vala-list <vala-list gnome org>
- Subject: Re: [Vala] Gtk.TreeView + Cellrender + text different colors ???
- Date: Thu, 11 Aug 2016 00:09:20 -0300
That does not work.
According to the documentation you must specify the column number.
In my example I have two columns but I want to change the color of the
letter only in the second column and the color varies according to row.
In short my example says:
...
Gtk.CellRendererText cell = new Gtk.CellRendererText();
insert_column_with_attributes(-1, "Line", cell, "text", 0, null);
cell = new Gtk.CellRendererText();
cell.set("foreground_set", true);
insert_column_with_attributes(-1, "Content", cell, "text", 1, null);
...
treeview.append(out iter, rootiter);
treeview.set(iter, 0, item.line, 1, item.def, -1);
How would you do in this instance?
2016-08-10 23:21 GMT-03:00 Michael Gratton <mike vee net>:
Hi Flavio,
On Thu, Aug 11, 2016 at 11:34 AM, Flavio Danesse <fdanesse gmail com>
wrote:
Hello, to see if anyone knows how to do this ? I try pass this code python
to Vala:
self.get_model (). append ( _iter , [int (key) , text, color] )
The idea is that adding a new element in a treeview , you can specify a
particular color in that cellrender I tried a little of everything and
nothing seems to work
In Vala, you get the newly appended row out first and then set values on
it, e.g.:
Gtk.ListStore model = ...
Gtk.TreeIter iter;
model.append(out iter);
model.set(iter, int(key), text, color);
HTH,
//Mike
--
⊨ Michael Gratton, Percept Wrangler.
⚙ <http://mjog.vee.net/>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]