Re: NSCell mouse tracking best practices.
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