Re: Back-to-back NSOpenPanel runModal blocking each other
Re: Back-to-back NSOpenPanel runModal blocking each other
- Subject: Re: Back-to-back NSOpenPanel runModal blocking each other
- From: Sean McBride <email@hidden>
- Date: Tue, 30 Jun 2015 16:41:03 -0400
- Organization: Rogue Research Inc.
On Tue, 30 Jun 2015 20:17:29 +0000, Quincey Morris said:
>In the dialog APIs that have a completion handler, there’s a free
>‘orderOut:’ after the handler returns, if it didn’t do that already. I’d
>assume that this is is what’s internally causing the ‘orderOut:’ to
>happen later than you wish, and of course you have no direct control
>over this.
Calling orderOut: myself (right after runModal) doesn't actually order the window out either. :(
>Possible workarounds:
>
>1. Don’t use a loop, but rather than a chain of dispatches. That is, put
>the prompt code in a block that takes some parameters, and at the end of
>the block do a dispatch_async (dispatch_get_main_queue (), …) of the
>block with some new parameters. This should queue your next dialog after
>a block that’s been queued to do the ‘orderOut:’, which will defer the
>new dialog until the old one is gone. (This is basically your ‘sleep’
>workaround, but without any delay.)
>
>2. Use ‘beginWithCompletionHandler:’ instead of ‘runModal’. The only
>downside is that it’s not modal, so the dialog could get hidden by other
>windows of your app, if the user clicks on the wrong thing.
Thanks for the suggestions. The difficulty will be that this old code really requires the synchronous nature of runModal, as the found NSURL must be returned up to the calling function. Really I should get around to cleaning it all up one day... :)
Cheers,
--
____________________________________________________________
Sean McBride, B. Eng email@hidden
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
_______________________________________________
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