Re: NSButtonCell doesn't visually update during trackMouse:inRect:ofView:untilMouseUp:
Re: NSButtonCell doesn't visually update during trackMouse:inRect:ofView:untilMouseUp:
- Subject: Re: NSButtonCell doesn't visually update during trackMouse:inRect:ofView:untilMouseUp:
- From: glenn andreas <email@hidden>
- Date: Mon, 17 Mar 2008 10:49:55 -0500
On Mar 17, 2008, at 1:42 AM, Ben Lachman wrote:
I have a few NSButtonCells that I'm using in a custom view. I need
them to track the mouse during clicks and do this by calling
NSCell's trackMouse:inRect:ofView:untilMouseUp:. This works fine
except that the button cells never update their graphical state by
highlighting or whatever. However if I call performClick: on them
the button updates as it should. Is the only solution to this to
implement mouse tracking at the view instead of at the cell level?
You need to set the control view of the cell to your view and then
implement the appropriate [update|draw]cell[inside]: methods in your
view. Basically a cell expects to be inside a control and needs to be
able to tell that control to draw itself (and thus redraw the cell).
One would think that the parameters to trackMouse would be sufficient
to have the cell handle this by itself, but since a control could have
a background behind the cell, it's really up to the control to decide
how to redraw the cell.
Glenn Andreas email@hidden
<http://www.gandreas.com/> wicked fun!
quadrium | prime : build, mutate, evolve, animate : the next
generation of fractal art
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden