Re: row bg color in NSOutlineView
Re: row bg color in NSOutlineView
- Subject: Re: row bg color in NSOutlineView
- From: jgo <email@hidden>
- Date: Fri, 21 Dec 2001 22:29:56 -0800
>
jcr wrote:
>
> On Friday, 2001 December 21 at 04:03, Raphael Sebbe wrote:
>
> What is the best way of setting the background color in an
>
> outline view, per row, based on item kind? I tried some custom
>
> data cells (NSTextFieldCell) but its background color is
>
> ignored (or changed to white just before drawing?)...
>
>
>
> Also, if that can help, I use a custom NSTableColumn subclass.
>
>
To save storage, NSTableView reuses cells to draw multiple items.
Are they that massive? I thought that part of the idea of cells
is that they're lighter than views.
>
The docs say:
>
>
- (void)tableView:(NSTableView *)aTableView
>
willDisplayCell:(id)aCell forTableColumn:(NSTableColumn
>
*)aTableColumn row:(int)rowIndex
>
>
Informs the delegate that aTableView will display the cell at
>
rowIndex in aTableColumn using aCell. The delegate can modify
>
the display attributes of aCell to alter the appearance of the
>
cell. Because aCell is reused for every row in aTableColumn, the
>
delegate must set the display attributes both when drawing
>
special cells and when drawing normal cells.
I don't quite get this. If one can set the cell for a specific
point in the table (column & row), then it must not be getting
re-used everywhere. But if it does get re-used, then it's
phony for it to say you're setting a particular row+column point,
and having that result in every corresponding point in the table
being affected, it's fiendish. Better grit one's teeth &
recognize that end-users will expect to be able to have rows
with different heights, columns or rows with different back-
ground colors, and want full, friendly data entry in each.
John G. Otto, Eagle Scout, Knight, Cybernetic Praxeologist
Existence, Consciousness, Identity, Life, Liberty, Property, Privacy, Justice