Re: NSEvent mouse events
Re: NSEvent mouse events
- Subject: Re: NSEvent mouse events
- From: mw <email@hidden>
- Date: Wed, 09 Oct 2002 07:15:11 -0400
On 10/9/02 1:00 AM, "email@hidden"
<email@hidden> wrote:
>
Hi,
>
I have a custom view that handles the mouse down event. I am trying to
>
get it so that if the mouse is down for 2 seconds, than it will perform
>
an action.
>
>
I wait for these mouse events
>
nextEventMatchingMask:(NSLeftMouseDownMask | NSLeftMouseUpMask |
>
NSLeftMouseDraggedMask | NSOtherMouseUpMask | NSOtherMouseDownMask),
>
but the problem seems to be that when I hold down the mouse, without
>
moving the mouse at all, it does not generate any more events. As soon
>
as i move the cursor slightly, it then fires the action. Is there a way
>
of getting a continuous stream of events while the mouse is down? Or is
>
there a better solution to this problem?
>
>
Any help is greatly appreciated,
>
Regards,
>
Greg
Couldn't you use NSResponders method? NSWindow is a subclass of it.
- (void)mouseDown:(NSEvent *)theEvent
You could also try using this method.
- (NSEvent *)nextEventMatchingMask:(unsigned int)mask untilDate:(NSDate
*)expiration inMode:(NSString *)mode dequeue:(BOOL)flag
Just make sure that inMode is NSEventTrackingRunLoopMode (the method you are
using actually calls this function with no expiration and inMode as
NSDefaultRunLoopMode. Try it the way I suggested (look it up in
NSApplication's reference to get all of the possible values for all of the
parameters).
Hope that helped!
mw
_______________________________________________
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.