Re: Alt. Background color and variable row height in NSTableView and NSOutlineView
Re: Alt. Background color and variable row height in NSTableView and NSOutlineView
- Subject: Re: Alt. Background color and variable row height in NSTableView and NSOutlineView
- From: Dan Wood <email@hidden>
- Date: Tue, 09 Oct 2001 11:16:03 -0700
I think you have the right approach. You need to set the
background color on each cell, or any other per-cell attributes,
with tableView:willDisplayCell:forTableColumn:row:. As far as
changing row heights, there's no easy solution. You'll probably
have to override the methods you describe below; it may be easier
*not* to call super, but instead just store all the row heights
yourself and calculate it for yourself. (Though you might want to
invoke super to get the widths, and you just maintain the heights.
--- Dan (who has mucked around with table columns similarly, but
not rows)
On Tuesday, October 9, 2001, at 10:21 AM, Alykhan Jetha wrote:
Gang,
I have 2 questions. I feel they should be obvious but I'm not
finding the appropriate method(s). I could be missing something.
1) I want to set alternating background row colors in a tableview
and an outlineview. The only thing I've found is the ability to
set the cell background color (and set the background color on the
whole table), so I'd have to set the background color on each
cell. It' seems like overkill to me. Am I missing some obvious
method to set the color or return the background color for a given
row?
2) Both tableview and outlineview have a default row height. Is
there an easy way to change the row height on a row by row basis.
I found the following methods.
- (NSRect)rectOfRow:(int)row;
- (NSRect)frameOfCellAtColumn:(int)column row:(int)row;
Should I subclass outlineview and tableview, call super rectOfRow,
then modify the height to reflect my needs (i.e. a multi-line
wrapped textfield cell)?
Once again, I'm feeling like I'm missing something obvious.
TIA
./aj
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
--
Dan Wood
email@hidden
http://www.karelia.com/
http://www.bikealameda.org/
Mac OS X Developer: Online Resume:
http://www.karelia.com/resume.html