• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Document being reopened on launch during modal dialog
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Document being reopened on launch during modal dialog


  • Subject: Re: Document being reopened on launch during modal dialog
  • From: Graham Cox <email@hidden>
  • Date: Wed, 07 May 2014 10:05:22 +1000

On 7 May 2014, at 5:41 am, Quincey Morris <email@hidden> wrote:

> On May 6, 2014, at 12:28 , Lee Ann Rucker <email@hidden> 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 (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


  • Follow-Ups:
    • Re: Document being reopened on launch during modal dialog
      • From: "Mills, Steve" <email@hidden>
References: 
 >Document being reopened on launch during modal dialog (From: "Mills, Steve" <email@hidden>)
 >Re: Document being reopened on launch during modal dialog (From: Lee Ann Rucker <email@hidden>)
 >Re: Document being reopened on launch during modal dialog (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: How to convert a UTF-8 byte offset into an NSString character offset?
  • Next by Date: Re: Auto layout and re-sizing subviews.
  • Previous by thread: Re: Document being reopened on launch during modal dialog
  • Next by thread: Re: Document being reopened on launch during modal dialog
  • Index(es):
    • Date
    • Thread