Re: stopTracking in NSButtonCell [solution]
Re: stopTracking in NSButtonCell [solution]
- Subject: Re: stopTracking in NSButtonCell [solution]
- From: "Louis C. Sacha" <email@hidden>
- Date: Tue, 16 Mar 2004 13:07:58 -0800
Hello...
Sorry, I didn't have a whole lot of time when I wrote that, but what
I meant is that you could override
trackMouse:inRect:ofView:untilMouseUp: to look something like this:
- (BOOL)trackMouse:(NSEvent *)theEvent inRect:(NSRect)cellFrame
ofView:(NSView *)controlView untilMouseUp:(BOOL)untilMouseUp
{
BOOL mouseIsUp = [super trackMouse:theEvent inRect:cellFrame
ofView:controlView untilMouseUp:untilMouseUp];
/* you could probably do whatever you had wanted to do in
stopTracking:at:inView:mouseIsUp: here */
return mouseIsUp;
}
I haven't actually tested this, this is just based on what the
documentation says (which is the other reason I didn't go into much
detail before, and sent the message off-list).
Also, if you needed to change when the cell stops tracking the mouse
for your particular button cell class (ie to allow tracking just
within the cell or anywhere), you could do it by overriding the class
method prefersTrackingUntilMouseUp.
Hope that helps,
Louis
Yes, I did, that's where I got "stopTracking:... etc.". Anyways, if
anyone is interested, the solution is completely rewriting
trackMouse:inRect;ofView:untilMouseup: yourself, since it in fact
does not call stopTracking:...
On Mar 15, 2004, at 11:19 PM, Louis C. Sacha wrote:
Hello...
You may want to read the documentation for some of the other NSCell
methods for "Tracking the mouse", specifically
- trackMouse:inRect:ofView:untilMouseUp:
+ prefersTrackingUntilMouseUp
Hope that helps,
Louis
Does NSButtonCell not call stopTracking:at:inView:mouseIsUp:? I'm
trying to write a button that has a special look when it
experiences a roll over (i think there is some sample code for
this too if anyone has it, part of adc tips maybe?). ANyways, I
have it almost completely working, except when someone holds down,
and drags away, in which case mouseExited is NOT called because
the control's cell, NSButtonCell, has intercepted all these
events. So I said, I'll just subclass the cell class as well to
let me know, but apparently it does not respond to
stopTracking:at:inView:mouseIsUp:, so is this proper, and
secondly, how can I get around this?
Francisco Tolmasky
email@hidden
http://www-scf.usc.edu/~tolmasky/
Francisco Tolmasky
email@hidden
http://www-scf.usc.edu/~tolmasky/
--
Louis C. Sacha
<email@hidden>
or <email@hidden>
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.