RE: Change the background colour of only one cell of a GtkTreeView.
- From: "Freddie Unpenstein" <fredderic excite com>
- To: gtk-app-devel-list gnome org
- Subject: RE: Change the background colour of only one cell of a GtkTreeView.
- Date: Tue, 6 Dec 2005 09:57:02 -0500 (EST)
I'm tying to change the background colour of an independant cell
of a GtkTreeView. I have utility functions to change the colour
of a row, adding a new column to the GtkTreeModeland use it to
set the row colour. When i created the GtkTreeViewColumns, i've
created a new GtkCellRendererText object for each column.
Iterating between columns, i could change the colour of cells in
the same column, but the last modification will be the final
colour. My problem is that i want to change the clour of a unique
cell.
As I understand it, you basically have two options;
1) an extra data field containing a colour can be linked to the colour setting of a column. Then for each
cell rendered in that column, the relevant field in the data set will be checked to obtain the colour to use
for that cell. Unfortunately, if you need to independantly control the colour of cells in three different
columns, that would mean adding three extra colour fields to the data set. If you've got a large number of
rows to display, that could prove to be quite a few extra fields.
2) the other option, probably the better one, is to attach a function which is called for each row that gets
rendered. This function is then free to modify the cell renderer settings however it wishes (such as
changing the colour) just before the cells for that column get rendered. So by reconfiguring the colour of
each column prior to the rendering of each row, you have compleate (and individual) control over each and
every cell in the table.
Fredderic
_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]