[Pythonmac-SIG] NSTableView and NSOutlineView backgrounds

Bob Ippolito bob at redivi.com
Mon Oct 13 13:09:40 EDT 2003


On Monday, Oct 13, 2003, at 12:41 America/New_York, Dinu Gherman wrote:

> I'm fiddling with coloring cells in TableViews and OutlineViews,
> and it seems like I must be doing something very stupid. In any
> case I can't get the cells colored as I like. They just seem to
> "overpaint" themselves with the standard white background.
>
> The funniest thing of all is: I can see the background color tem-
> porarily when attempting to edit a cell's content, but afterwards
> it disappears again... It's really driving me nuts... Here's the
> sample code if somebody has a minute to look at it:
>
>   http://python.net/~gherman/tmp/TableViewTest.tar.gz
>
> One column should be coloured in alternating red and yellow, but
> it isn't.

You're forgetting:
	cell.setDrawsBackground_(True)

Remember also that the same cell object gets reused, so make sure to 
set all the values that you need to set (i.e. turn the background off 
for the other column, set the color to white, etc.).

-bob




More information about the Pythonmac-SIG mailing list