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: "Ken Ferry" <email@hidden>
- Date: Mon, 17 Mar 2008 13:25:26 -0700
On Mon, Mar 17, 2008 at 8:49 AM, glenn andreas <email@hidden> wrote:
>
> 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.
Or, a bit more specifically, setControlView: will fail to store
anything if the passed view is not an NSControl. You can use an
NSCell to purely stamp out drawing in an NSView, but more complicated
interaction requires the view to be an NSControl, so that the cell can
message the control in various ways. It isn't just updateCell:.
Ken Ferry
Cocoa Frameworks
> 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
>
_______________________________________________
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