FROM : mw
DATE : Wed Oct 09 13:15:11 2002
On 10/9/02 1:00 AM, "<email_removed>"
<<email_removed>> 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_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
DATE : Wed Oct 09 13:15:11 2002
On 10/9/02 1:00 AM, "<email_removed>"
<<email_removed>> 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_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
| Related mails | Author | Date |
|---|---|---|
| Greg Hulands | Oct 9, 04:19 | |
| mw | Oct 9, 13:15 |






Cocoa mail archive

