Re: runModalForWindow and NSTimer strange behavior
Re: runModalForWindow and NSTimer strange behavior
- Subject: Re: runModalForWindow and NSTimer strange behavior
- From: kristin <email@hidden>
- Date: Mon, 7 May 2001 12:42:02 -0700
The behavior you see is caused by running in different RunLoop modes.
When you call runModalForWindow:, your application enters a modal loop
so it runs in NSModalPanelRunLoopMode (from AppKit/NSApplication.h).
This stops your NSTimer, presumably because you have not added it to the
runloop for this mode (see -[NSRunLoop addTimer:forMode:]).
I agree that it is strange that clicking on the NSPopUpButton restarts
the timer. I believe this is because we enter the default runloop mode
when tracking in an NSPopUpButton (NSDefaultRunLoopMode, from
Foundation/NSRunLoop.h). I think this is a bug since the app should
really stay in the modal runloop mode until the modal window is
dismissed. But this is probably a secondary problem for you - if you
used -[NSRunLoop addTimer:forMode:] to add your timer in the
NSModalPanelRunLoopMode, then it would probably be invisible to you if
the application went into this other mode temporarily.
Kristin
On Monday, May 7, 2001, at 10:48 AM, Stiphane Sudre wrote:
>
Strange behavior with Mac OS X :
>
>
I have a main window which is doing a graphic animation with a NSTimer.
>
>
When I click on a button, a dialog appears and is managed with
>
runModalForWindow: .
>
>
At this instant, the animation is stopped. Why not...
>
>
In this dialog, I have a NSPopUpButton, when I click on this
>
PopUpButton, the animation resumes.
>
>
Strange, isn't it ?
>
>
Could it be a bug in runModalForWindow ?
>
_______________________________________________
>
cocoa-dev mailing list
>
email@hidden
>
http://www.lists.apple.com/mailman/listinfo/cocoa-dev