On Aug 19, 2009, at 5:05 PM, Ragavendar Swamisai wrote:
> Hi,
>
> I am trying to create a TreeView (with SimpleList) and I have a column
> where its value is set dynamically, and when the value in the column
> is set to a specific string I want to set the complete row to say RED.
> I am able to do that for a column using the 'attr' key in the
> SimpleList.
>
> Any pointers or code snippet will be helpful.
The easiest way is to have a hidden row in your column that contains
the color you want to use. You'd calculate that when you insert the
data. Then, loop across all the columns in the view, adding an
attribute to control the color, like this:
foreach my $col ($view->get_columns ()) {
# NOTE: in newer gtk+, this is get_cells()
foreach my $cell ($col->get_cell_renderers ()) {
# assuming you're talking about the foreground color, and
that the
# model stores this as a string color name.
$col->add_attribute ($cell, foreground =>
HIDDEN_COLOR_COLUMN_INDEX);
}
}
If you want the background color, you may need to tweak.
If it needs to be more dynamic than that, or not use a column to store
this value, then you will need to use a cell data function, which
replaces your attributes, which means you want to do it by hand
instead of using SimpleList.
--
Applause is an addiction, like heroin or checking your email.
-- Sideshow Mel
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list@...
http://mail.gnome.org/mailman/listinfo/gtk-perl-list