Re: Notification for mouse-up on NSStepper
Re: Notification for mouse-up on NSStepper
- Subject: Re: Notification for mouse-up on NSStepper
- From: John Stiles <email@hidden>
- Date: Fri, 07 Dec 2007 08:54:56 -0800
I ended up overriding -mouseDown: to call super's mouseDown and then did
my update afterwards. And comments aplenty to explain the situation.
It relies on implementation details, but I think Glenn's code also
relies on (different) implementation details, so if it's six of one and
a half dozen of the other, I'll take the more direct approach. ;)
Alastair Houghton wrote:
On 7 Dec 2007, at 14:56, glenn andreas wrote:
You can do this:
- (void) mouseDown: (NSEvent *) event
{
[super mouseDown: event];
if ([[NSApp currentEvent] type] == NSLeftMouseUp) {
[self doSomethingAfterTracking];
}
}
- (void) mouseUp: (NSEvent *) event
{
[self doSomethingAfterTracking];
}
So if the super's mouseDown does the tracking loop, the current event
will be the mouse up (that stopped the tracking loop). If it
doesn't, then mouseUp will be called like normal.
Hmmm. I hadn't thought of checking -currentEvent. If we assume that
there are no guarantees from Apple, it's better than doing nothing,
though I think it still isn't completely robust wrt changes in the
superclass.
Kind regards,
Alastair.
--
http://alastairs-place.net
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden