• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSEvent mouse events
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: Re: Select root of NSMenu's Sub Menu?
  • Next by Date: - (void)mouseEntered:(NSEvent *)theEvent
  • Previous by thread: NSEvent mouse events
  • Next by thread: How to use "SEL"
  • Index(es):
    • Date
    • Thread