Re: NSTimer Problem
Re: NSTimer Problem
- Subject: Re: NSTimer Problem
- From: Doug Brown <email@hidden>
- Date: Sun, 12 May 2002 11:54:12 -0700
Greg,
Thank you! That fixed it. I didn't know about the run loop - that's good
to know for the future.
Thanks,
Doug
On Sunday, May 12, 2002, at 11:49 AM, Greg Titus wrote:
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.