• 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: Receiving user events from within an NSTimer callback
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Receiving user events from within an NSTimer callback


  • Subject: Re: Receiving user events from within an NSTimer callback
  • From: Quincey Morris <email@hidden>
  • Date: Thu, 22 Jan 2009 16:34:07 -0800

On Jan 22, 2009, at 14:55, John Mikros wrote:

I'm working on a Cocoa application which does all of its work within an NSTimer callback that is called regularly. Events are handled normally within a Cocoa run loop.

However, there are times when within the callback, the code enters an inner loop, and will not exit until some user action is performed.
I'm trying to force the run loop to pump events within this inner loop, but I can't seem to ever get it to work.

I use, from the timer callback:

NSEvent *event;
while (event = [NSApp nextEventMatchingMask: NSAnyEventMask untilDate: nil inMode: NSEventTrackingRunLoopMode dequeue: YES])
[NSApp sendEvent: event];


I don't know if this is officially blessed or not, but it certainly seems to work just fine.

In the places I've done this, I was only really interested in making the mouse and keyboard work, hence NSEventTrackingRunLoopMode. You could use the default run loop mode instead, I guess.


_______________________________________________

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


  • Follow-Ups:
    • Re: Receiving user events from within an NSTimer callback
      • From: Michael Ash <email@hidden>
References: 
 >Receiving user events from within an NSTimer callback (From: John Mikros <email@hidden>)

  • Prev by Date: What does errAuthorizationToolEnvironmentError mean?
  • Next by Date: puzzled about speech synthesis
  • Previous by thread: Receiving user events from within an NSTimer callback
  • Next by thread: Re: Receiving user events from within an NSTimer callback
  • Index(es):
    • Date
    • Thread