• 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: NSTimer Problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTimer Problem


  • Subject: Re: NSTimer Problem
  • From: Greg Titus <email@hidden>
  • Date: Sun, 12 May 2002 11:49:06 -0700

Hi Doug,

You need to add this line when you set up your timer:

myTimer = ...
[[NSRunLoop currentRunLoop] addTimer:myTimer forMode:NSEventTrackingRunLoopMode];

Run loops have multiple modes and input sources and timers can be registered to go off in one or more of those modes. When you have your mouse down on a button, the button switches the run loop from NSDefaultRunLoopMode into NSEventTrackingRunLoopMode, so if you want your timer to continue to fire, it has to be registered for that mode as well.

Read the NSRunLoop documentation in Foundation for more details...

Hope this helps,
--Greg

On Sunday, May 12, 2002, at 10:41 AM, Doug Brown wrote:

Hi everyone,

I'm having what seems to be a very simple problem with NSTimers. I have a timer set up to repeatedly fire, but when I hold down the mouse on a button in the window, or on the "minimize" button at the top of the window, the timer stops firing. Is there a way to get it to keep firing even when the user is holding down the mouse on one of these buttons? By the way, bringing down a menu from the menu bar does not make it pause. Any ideas?

Thanks,
Doug
_______________________________________________
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.
_______________________________________________
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.

  • Follow-Ups:
    • Re: NSTimer Problem
      • From: Doug Brown <email@hidden>
References: 
 >NSTimer Problem (From: Doug Brown <email@hidden>)

  • Prev by Date: Re: NSTimers starting, stopping, pausing...
  • Next by Date: Re: NSTimer Problem
  • Previous by thread: NSTimer Problem
  • Next by thread: Re: NSTimer Problem
  • Index(es):
    • Date
    • Thread