Re: Custom highlight selection in NSOutlineView
Re: Custom highlight selection in NSOutlineView
- Subject: Re: Custom highlight selection in NSOutlineView
- From: David Aames <email@hidden>
- Date: Wed, 20 Sep 2006 12:46:08 +0100
Hello there,
I wanted to see which call was responsible for drawing this rectangle
so I fired up Shark and it was
-(void)_drawHighlightWithFrame:(NSRect)frame inView:(NSView*)view
After providing an empty implementation everything worked fine but I
wonder what's is the proper way of doing it? NSCell docs don't even
seem to mention this method (it's private). So the question is what
is the proper way to make the NSOutlineView to draw the highlight and
leave NSCell alone (ie not request it to draw the highlight). BTW
overriding - (void)highlight:(BOOL)flag withFrame:(NSRect)cellFrame
inView:(NSView *)controlView (of NSCell) with an empty body doesn't
actually fix the problem. Can anyone please clarify the situation
(overriding private methods is a Bad Thing (tm)) because I think I'm
not the only one having this problem.
Kind regards,
David
On 20 Sep 2006, at 12:26, Alan Smith wrote:
I had this problem with an NSOutlineView when I set the classPrototype
to an NSBrowserCell. NSBrowserCell has its own highlighting methods. I
simply overrid the one that asked for the highlight color and returned
nil.
Since you are using a custom cell class I suggest you look through
that code (specifically, drawInteriorWithFrame:, or whatever, the cell
drawing one) and find where it is drawing a rectangle.
If you weren't using a custom cell you could use [outlineView
cellPrototype] (or a method to that affect) and find out what cell it
was using. Then use class-dump on the framework that contained that
cell class and look for any highlight type methods. That is how I got
a NSBrowserCell class to draw a gradient on itself instead of a
uniform color.
Hope this helps, Alan
--
// Quotes from yours truly -------------------------
"You don't forget, you just don't remember."
"Maturity resides in the mind."
"Silence is the Universe's greatest gift."
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden