• 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: Óscar Morales Vivó <email@hidden>
  • Date: Wed, 5 Jul 2006 18:41:05 -0400

That code sure was helpful.

Only one small doubt: when using the custom cell inside something like a NSTableView or NSMatrix, will bindings just "magically work" as long as they point to objects of a type that the cell knows what to do with? (i.e. if the "value" binding is set to something that returns an NSCalendarDate object for your clock cell it would work, but if ending up with an NSNumber it wouldn't).

BTW, I'll file a bug when I get the time, but I think the "subclassing NSCell" guide should be much more extensive, at least pointing how to deal with common cases like this one. After researching the whole NSControl/NSCell thing I'm surprised that it's not really that much of a big deal, but the documentation fails to make the case for that.

Again, thanks for your help:

Óscar Morales Vivó

On Jul 5, 2006, at 16:40 , mmalc crawford wrote:


On Jul 5, 2006, at 1:17 PM, Óscar Morales Vivó wrote:

- Keep around an instance variable for the tracking rectangle. Fill it up in trackMouse:inRect:ofView:untilMouseUp: right before calling super, and then override startTrackingAt:inView:, continueTracking:at:inView and stopTracking:at:inView:mouseIsUp: (NSSliderCell seems to do this).
- Just override the whole trackMouse:inRect:ofView:untilMouseUp: taking care of the event loop there and ignoring the other three mouse tracking methods (That's what the clock control sample code does).


Personally I would avoid the latter since it makes it more difficult to alter behaviour in a subclass -- depending on what you do, it may also interfere with support for bindings.

I've put an updated, bindings-enabled, version of ClockControl at:
	<http://homepage.mac.com/mmalc/CocoaExamples/ClockControl2a.zip>

Note that it (still) represents a work in progress. Bug reports are welcome.

mmalc


_______________________________________________ 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
References: 
 >Fwd: NSCell mouse tracking best practices. (From: Óscar Morales Vivó <email@hidden>)
 >Re: NSCell mouse tracking best practices. (From: mmalc crawford <email@hidden>)

  • Prev by Date: NSArrayController, TableView and not showing data
  • Next by Date: Re: First Responder and menus
  • Previous by thread: Re: NSCell mouse tracking best practices.
  • Next by thread: Re: NSCell mouse tracking best practices.
  • Index(es):
    • Date
    • Thread