• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Handling mouse events in NSCell's?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Handling mouse events in NSCell's?


  • Subject: Re: Handling mouse events in NSCell's?
  • From: Ken Ferry <email@hidden>
  • Date: Fri, 18 Sep 2009 02:12:29 -0700

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

  • Follow-Ups:
    • Re: Handling mouse events in NSCell's?
      • From: Raleigh Ledet <email@hidden>
References: 
 >Handling mouse events in NSCell's? (From: aaron smith <email@hidden>)

  • Prev by Date: Handling mouse events in NSCell's?
  • Next by Date: Re: NSRunLoop issue
  • Previous by thread: Handling mouse events in NSCell's?
  • Next by thread: Re: Handling mouse events in NSCell's?
  • Index(es):
    • Date
    • Thread