On 7 May 2014, at 5:41 am, Quincey Morris <quinceymor...@rivergatesoftware.com> 
wrote:

> On May 6, 2014, at 12:28 , Lee Ann Rucker <lruc...@vmware.com> wrote:
> 
>> This may be obvious, but did you try moving it all to 
>> applicationDidFinishLaunching: instead?
> 
> IIUC, Steve’s point was that it won’t help in this case, because state 
> restoration is initiated before applicationDidFinishLaunching:, and he’s 
> actually trying to defer state restoration, of documents at least, until 
> after the modal dialog is dismissed.


FWIW, showing a modal dialog during app launch has always been awkward and 
difficult - documents will open "behind" the dialog unless you go out of your 
way to prevent it, no matter at what point you invoke the dialog, because the 
modal loop ends up running an event loop which processes the 'open' events, 
etc. This can bypass any setup you do in will/finish launching, which runs 
after the modal loop ends (running modelessly might help with that).

You'll probably have to resort to setting flags in your delegate when you show 
the dialog and use those flags to short-circuit document opening. If the dialog 
is then cancelled or dismissed, if your app wants to go ahead and open the 
documents it would have done, you'll have to arrange some mechanism to capture 
the 'open' events (or at least the document URLs they refer to) and handle them 
later. It's a huge mess, so basically it comes down to being unsupported.

The compromise we've adopted is to let all the documents open as normal *then* 
show the dialog if necessary on top of them. That avoids the need to capture 
the 'open' URLs, but it's only OK if you can accept the documents being there - 
in our case we can. Doing this is fairly simple though - just invoke the dialog 
opening method after a short delay (1 second in our case) - it's enough to 
ensure it happens after all doc opening has completed, since the true main 
event loop runs normally, opens the documents, then processes any pending 
'perform after delay' stuff.

--Graham



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to