Re: NSBrowser cell highlighting
Re: NSBrowser cell highlighting
- Subject: Re: NSBrowser cell highlighting
- From: Tom Waters <email@hidden>
- Date: Wed, 6 Jun 2001 10:46:07 -0700
Thanks Chuck!
That did it. I hate when I forget to look in the release notes.
ps. I had gotten it working by checking to see if the controlView was
firstResponder:
if it was, paint it dark, otherwise paint it light. but this is much
cleaner.
On Wednesday, June 6, 2001, at 10:26 AM, Chuck Pisula wrote:
>
This is new, and is in the release notes:
>
>
NSBrowserCell
>
>
Selected cells in a browser's last column draw with a slightly darker
>
color than the rest of the browsers columns. Since it can be
>
problematic for cells to know what color their highlight should be, a
>
new method has been introduce in NSBrowserCell to help determine the
>
highlight color that should be used. The method's controlView parameter
>
will generally be the forwarded parameter of the same name from methods
>
like drawInteriorWithFrame:inView:
>
>
- (NSColor *)highlightColorInView:(NSView *)controlView;
>
>
So, in your subclass, if [self isHighlighted], use [[self
>
highlightColorInView:v] set], otherwise use your background color.
>
>
-chuck
>
>
On Tuesday, June 5, 2001, at 04:45 PM, Tom Waters wrote:
>
>
> I have a custom cell inside of an NSBrowser.
>
>
>
> I note that when I use regular NSBrowserCells, the selected branch
>
> nodes are painted in a lighter color when they aren't in the
>
> "right-most" column.
>
>
>
> I've been examining [NSCell isHighlighted] and [NSCell state] for
>
> clues as to how the cell "knows" to paint this lighter color without
>
> success.
>
>
>
> Does anyone know what the convention is?
>
>
>
> (This is the kind of thing that is missing from the documentation,
>
> because as everyone knows, you're NOT supposed to have to subclass
>
> anything in cocoa...)