• 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: NSCell mouse tracking best practices.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSCell mouse tracking best practices.


  • Subject: Re: NSCell mouse tracking best practices.
  • From: Matt Neuburg <email@hidden>
  • Date: Thu, 06 Jul 2006 19:42:51 -0700
  • Thread-topic: NSCell mouse tracking best practices.

On Wed, 5 Jul 2006 20:23:16 -0700, Corbin Dunn <email@hidden> said:
>>
>> My app (NotLight) uses an NSImageCell subclass. What I do is:
>>
>> (1) I implement trackMouse:, as you say.
>
>That's required for NSImageCell because it isn't meant to be tracked.
>You have to do your own tracking (it, by default, just returns NO).

Great to know (though it's hard to see why I wouldn't want tracking in an
image cell). However, the docs say something very different:

<http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Cla
sses/NSCell_Class/Reference/Reference.html#//apple_ref/occ/instm/NSCell/trac
kMouse:inRect:ofView:untilMouseUp:>

"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."

Nothing tells me that NSImageCell "isn't meant to be tracked", so naturally
I assumed that it inherited its behavior from NSCell. As a result I spent a
lot of time trying everything I could think of so as *not* to have to
override this method.

> 1. Return YES if you handled mouse up in  your trackMouse: method.
> 2. Return YES from +prefersTrackingUntilMouseUp, which defaults to NO
> for NSCell.

I don't grasp how that helps me. Changing the value returned from
+prefersTrackingUntilMouseUp changes the value passed into the last argument
of trackMouse:..., but it does not cause my cell to get an event when the
mouse ultimately goes up, which is what I need.

>PS: a plug for WWDC -- I'm giving an "Advanced Controls and Cells"
>talk (called "Beyond Buttons") at WWDC this year. I'm covering the ins
>and outs of this.

That sounds terrific, and I plan to attend. But it would be cool, too, if
the docs were simply factual and instructive on matrices and cells. m.

--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>



 _______________________________________________
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

  • Follow-Ups:
    • Re: NSCell mouse tracking best practices.
      • From: Corbin Dunn <email@hidden>
  • Prev by Date: more drag source problem
  • Next by Date: Fwd: Bindings Bug?
  • Previous by thread: Re: NSCell mouse tracking best practices.
  • Next by thread: Re: NSCell mouse tracking best practices.
  • Index(es):
    • Date
    • Thread