• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: alternating background in rows of NSCell subclass
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


References: 
 >alternating background in rows of NSCell subclass (From: Chuck Soper <email@hidden>)

  • Prev by Date: Re: Deleting duplicates in NSMutableArray
  • Next by Date: Use different window than File Owner's in NIB
  • Previous by thread: alternating background in rows of NSCell subclass
  • Next by thread: Re: figuring out the length of a string
  • Index(es):
    • Date
    • Thread