Re: Handling mouse events in NSCell's?
Re: Handling mouse events in NSCell's?
- Subject: Re: Handling mouse events in NSCell's?
- From: Raleigh Ledet <email@hidden>
- Date: Fri, 18 Sep 2009 10:11:32 -0700
I agree with Ken and strongly encourage you to use the three tracking
methods already defined in the NSCell documentation
raleigh.
On Sep 18, 2009, at 2:12 AM, Ken Ferry wrote:
Hi Aaron,
You should take a look at the NSCell
docs<http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ApplicationKit/Classes/NSCell_Class/Reference/NSCell.html#//apple_ref/occ/instm/NSCell/trackMouse:inRect:ofView:untilMouseUp:
>
.
-Ken
trackMouse:inRect:ofView:untilMouseUp:
Discussion
This method is *generally not overridden* because the default
implementation
invokes other NSCell methods that can be overridden to handle specific
events in a dragging session. This method’s return value depends on
the *
untilMouseUp* flag. If *untilMouseUp* is set to YES, this method
returns YES if
the mouse button goes up while the cursor is anywhere; NO,
otherwise. If *
untilMouseUp* is set to NO, this method returns YES if the mouse
button goes
up while the cursor is within *cellFrame*; NO, otherwise.
This method first invokes
*startTrackingAt:inView:*<http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ApplicationKit/Classes/NSCell_Class/Reference/NSCell.html#//apple_ref/occ/instm/NSCell/startTrackingAt:inView:
>.
If that method returns YES, then as mouse-dragged events are
intercepted, *
continueTracking:at:inView:*<http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ApplicationKit/Classes/NSCell_Class/Reference/NSCell.html#//apple_ref/occ/instm/NSCell/continueTracking:at:inView:
>
is
invoked until either the method returns NO or the mouse is released.
Finally, *stopTracking:at:inView:mouseIsUp:*<http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ApplicationKit/Classes/NSCell_Class/Reference/NSCell.html#//apple_ref/occ/instm/NSCell/stopTracking:at:inView:mouseIsUp:
>
is
invoked if the mouse is released. If *untilMouseUp* is YES, it’s
invoked
when the mouse button goes up while the cursor is anywhere. If
*untilMouseUp
* is NO, it’s invoked when the mouse button goes up while the cursor
is
within *cellFrame*. You usually override one or more of these
methods to
respond to specific mouse events.
On Fri, Sep 18, 2009 at 1:33 AM, aaron smith <
email@hidden> wrote:
What's the proper way of handling simple mouse events in NSCell's?
Like mouseUp, mouseDown, etc.
I see that an NSControl implements NSResponder, but wasn't sure if
that's the right way to do it. Because of the fact that tables
usually
use cell's rather than a control. I've also been looking at the
method
trackMouse:inRect:ofView:untilMouseUp: but this method doesn't ever
get fired when the mouse is up.
Any ideas?
Thanks.
_______________________________________________
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
_______________________________________________
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