Re: Custom Cell highlighting
Re: Custom Cell highlighting
- Subject: Re: Custom Cell highlighting
- From: Ryan Stevens <email@hidden>
- Date: Sun, 27 Mar 2005 20:04:27 -0800
On Mar 27, 2005, at 6:49 PM, Michael Becker wrote:
Am 25.03.2005 um 18:21 schrieb Ryan Stevens:
On Mar 25, 2005, at 7:05 AM, Michael Becker wrote:
Hello!
This problem seems to have been around before, but I could not find any solution on the web/list-archive. Here's the deal:
I have a custom NSCell in my NSTableView. The cell is set up to display an image and a button. So far, everything works nicely, except for one thing:
The button is an image button and when the cell is highlighted, I want to change the image on that button. I tried overriding - (void)highlight:withFrame:inView: in my NSCell subclass. But this method obviously is never called. Why not? :-)
There is basically nothing special about my set-up. It's really just a simple NSCell subclass whose -highlight:withFrame:inView: does not get called. Does anybody have a clue what could be the cause of this here?
I'm betting you could just give the button cell an alternate image and have it taken care of for you. That or perhaps you could override drawWithFrame:inView: and check isHighlighted.
Yeah, I eventually ended up checking for isHighlighted in drawWithFrame:inView, which works alright. I still wonder, though, why highlight:withFrame:inView: does not get called. But at least it works now :-)
The constant
<x-tad-bigger>NSCellHighlighted</x-tad-bigger> is deprecated, with a note to use setHighlighted: instead so I kind of figured highlight:withFrame:inView: was heading in the same direction. I remember having the same problem but didn't really put it together until now, just got stuff working and left it at that.
Now that I think about it, when would highlight:withFrame:inView: be called? In drawWithFrame:inView:, after it has drawn the cell would make sense (if isHighlighted). But then what would you expect to happen if you called it from outside drawWithFrame:inView:? It would have to draw the content before it could highlight something but if it did that then it would loop if you were calling it in drawWithFrame:inView:...
Hrmm, wonder if I didn't just stumble on why it's fallen out of favor.
_______________________________________________
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