Re: Colorizing rows in SimpleList revisited



muppet, thanks.
The initial routines to connect the columns to the data only run once, so I don't think the penalty for looking up the properties is too high. The issue is that one could colorize, change weight, etc. with this function so keeping a table might require a big table knowing lots of pango thingies.

--john

muppet wrote:

it is possible to list the properties supported by an object, with $object->list_properties (or $class->list_properties).

however, this will be a real runtime hit, so you probably don't want to do it every time. two approaches would be:

1) use ref() to find the type of a cell renderer, and use that type to look up a function that knows how to colorize that cell renderer type.

2) after creating the model, create a cache of cell renderer types for each column, and query at this time whether they support the foreground property. then use that cached information later.

either way, you figure out ahead of time how to colorize a row, and you can either hand-code that knowledge or figure it out at runtime. since different renderers may use different names for the same attribute, i'd actually advocate method 1 here, which doesn't require listing properties at all.

--
John McDermott
Writer, Educator, Consultant
jjm jkintl com          http://www.jkintl.com
V +1 505/377-6293 F +1 505/377-6313




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