Skip navigation.
 
mlFwd: NSCell mouse tracking best practices.
FROM : Óscar Morales Vivó
DATE : Wed Jul 05 22:17:18 2006

I'm trying to implement a custom subclass of NSCell. As part of the 
work I need to implement mouse event tracking (down, drag & up as 
usual). The problem is that the methods in NSCell don't pass around 
the cell's frame and the information is needed to figure out the 
behavior while dragging. From what I've been reading in the docs, 
there's two possible solutions:

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

Not having ever done custom NSCell work before, I'd rather ask if 
there's any 'more sanctioned' way of doing this, as well as any 
potential pitfalls I might have missed. Pointers to discussions on 
the topic or more sample code would be welcome too.

Thanks in advance for your help:


Óscar Morales Vivó

Related mailsAuthorDate
mlFwd: NSCell mouse tracking best practices. Óscar Morales Vivó Jul 5, 22:17
mlRe: NSCell mouse tracking best practices. mmalc crawford Jul 5, 22:40
mlRe: NSCell mouse tracking best practices. Óscar Morales Vivó Jul 6, 00:41