Re: [Vala] Gtk.TreeView + Cellrender + text different colors ???



On Thu, Aug 11, 2016 at 1:09 PM, Flavio Danesse <fdanesse gmail com> wrote:
That does not work.
According to the documentation you must specify the column number.

Oh yes, right you are. If you add the column numbers to the ::set() call then the example should work.

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.

This is more of a general GTK+ question than specifically about Vala, but just create a model with at least three columns: One for the first view column's text, one for the second view column's text, and one for the second view column's colour:

Gtk.ListStore list_store = new Gtk.ListStore(3,
    typeof(string),
    typeof(string),
    typeof(string)
);

Then create the second view column that hools up the cell renderer's properties so they refer to the second two model columns:

insert_column_with_attributes(-1, "Content",
                              new Gtk.CellRendererText(),
                              "text", 1,
                              "foreground", 2,
                              null);

//Mike

--
⊨ Michael Gratton, Percept Wrangler.
⚙ <http://mjog.vee.net/>




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