• 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: Corbin Dunn <email@hidden>
  • Date: Wed, 5 Jul 2006 20:23:16 -0700


My app (NotLight) uses an NSImageCell subclass. What I do is:

(1) I implement trackMouse:, as you say. (I don't use any instance variable
for the tracking rectangle - I don't have to, because I'm not creating a
draggable image - but I do set some state switches telling me whether the
mouse is in a certain region.)

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



(2) In the NSMatrix subclass, I implement mouseUp and notify the relevant
cells that the mouse went up. This sort of cooperation between the NSMatrix
and the NSCells makes things very complicated, but for some purposes that's
just the way you have to do it. My NSCell didn't get any startTracking:...
(etc.) messages, and I assume that this is because it's an NSImageCell.
That's why I had to resort to the matrix's mouseUp instead. m.

You shouldn't have to do this; you need to:

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


--corbin

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.
_______________________________________________
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: Ricky Sharp <email@hidden>
    • Re: NSCell mouse tracking best practices.
      • From: Óscar Morales Vivó <email@hidden>
References: 
 >Re: NSCell mouse tracking best practices. (From: Matt Neuburg <email@hidden>)

  • Prev by Date: Re: NSTextView's "Replace All" issues
  • Next by Date: Re: two-way bindings and one-way bindings
  • Previous by thread: Re: NSCell mouse tracking best practices.
  • Next by thread: Re: NSCell mouse tracking best practices.
  • Index(es):
    • Date
    • Thread