Re: How to catch modal window appearance?
Re: How to catch modal window appearance?
- Subject: Re: How to catch modal window appearance?
- From: Ken Thomases <email@hidden>
- Date: Sat, 27 Mar 2010 11:22:09 -0500
On Mar 27, 2010, at 11:01 AM, Alexander Bokovikov wrote:
> Finally, one extra question. When modal window runloop starts? Does it start after the window is shown on screen or before that? If it starts after window showing then I'd use performSelector:withObject:afterDelay: to be sure that my procedure will start to execute itself when window is already visible.
Well, you can show the window yourself, explicitly, before invoking -runModalForWindow:, if you like. Then you can be sure the window is shown before the modal event loop starts.
The exact details of -runModalForWindow: are, of course, an implementation detail that is private to the framework, but the documentation for that method says, "[i]t displays the specified window, makes it key, starts the run loop, and processes events for that window." So, I assume it does those things in that order.
However, I continue to be confused as to why you care. What's the difference if the procedure starts a fraction of a second before the window is visible or a fraction of a second after?
Lastly, if you're going to try to use a -performSelector:... method to schedule something during that event loop, you're going to have to use one which allows you to specify the runloop modes in which it should fire (e.g. -performSelector:withObject:afterDelay:inModes:). Although, as I say, this technique is not necessary if all you're trying to do is show the window first.
> Thank you!
You're welcome.
Cheers,
Ken
_______________________________________________
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