Re: alternating background in rows of NSCell subclass
Re: alternating background in rows of NSCell subclass
- Subject: Re: alternating background in rows of NSCell subclass
- From: James DiPalma <email@hidden>
- Date: Mon, 5 Jul 2004 14:44:58 -0700
Have you tried subclassing NSTableView and using cells that do not draw
their background. NSTableView has a method:
-(void) drawRow:(int)row clipRect:(NSRect)rect
You can override this method, draw your background, and then call
[super drawRow:row clipRect:rect]. You probably want to check
isRowSelected: to handle selection. Its been a while since I looked at
this problem.
-jim
On Jul 4, 2004, at 11:54 PM, Chuck Soper wrote:
Hello,
In my Jaguar compatible application, I'm drawing a light blue
background on every other row of my NSTableView with the
willDisplayCell: delegate method shown below.
The problem is that I have a couple of NSCell subclasses. The methods
setDrawsBackground and setBackgroundColor are members of
NSTextFieldCell not NSCell. I can simply not draw the blue background
by adding the following code to the beginning of the willDisplayCell:
delegate method:
if (![cell isKindOfClass:[NSTextFieldCell class]])
return;
How can or should I draw a light blue background on every other row
in my NSCell subclass of my NSTableView in my Jaguar compatible
application? As far as I know, -
(void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView in
my NSCell subclass has no way of knowing what row it's drawing. Any
ideas?
Thanks,
Chuck
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.