Re: differentiating mouseDown, mouseUp, mouseDragged
Re: differentiating mouseDown, mouseUp, mouseDragged
- Subject: Re: differentiating mouseDown, mouseUp, mouseDragged
- From: Brock Brandenberg <email@hidden>
- Date: Fri, 17 Jan 2003 10:35:31 -0600
>
I have a continuous NSSlider in my app and I've hooked it up in IB to
>
an "sliderModified" action.
>
>
Unfortunately, I can see no way to distinguish between mouseDown,
>
mouseUp and mouseDragged events for the slider. In all three cases I
>
wind up in the sliderModified method and I can't find a way to tell
>
which type of mouse interaction got me there. (If there was something
>
like [NSEvent lastEvent] then I would try using that, but there doesn't
>
seem to be...)
>
>
I've tried subclassing NSSlider and putting overrides like this in the
>
subclass:
>
>
- (void)mouseUp:(NSEvent *)theEvent;
>
- (void)mouseDown:(NSEvent *)theEvent;
>
- (void)mouseDragged:(NSEvent *)theEvent;
>
>
But only the mouseDown: method ever gets called, not the other ones.
>
>
How can I find out what kind of action is resulting in my slider method
>
being called?
One way is to link against Carbon.framework and use the StillDown() function
in your method. It's an old method, but it's simple and works for the
intended purpose. It will help you distinguish the last mouseUp because
you'll be in your method and StillDown() will return "no".
If you need more event information, use the Carbon event manager that sits
underneath everything. It can provide a wealth of info that Cocoa does not.
Remember that Carbon and Cocoa can work together, and for some things like
the event loop, Carbon is what provides the procedural code running
underneath the higher level Cocoa framework.
Brock Brandenberg
----- industrial design @ www.bergdesign.com ------
_______________________________________________
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.