• 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: How to display errors/warnings at app startup? (Delaying the Opening of Files on Launch)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to display errors/warnings at app startup? (Delaying the Opening of Files on Launch)


  • Subject: Re: How to display errors/warnings at app startup? (Delaying the Opening of Files on Launch)
  • From: Scott Lehman <email@hidden>
  • Date: Thu, 5 Apr 2007 21:02:48 -0700 (PDT)

Just answering myself with a solution so it will be
archived for others.

I found a reasonably easy way to just delay the
opening of files until I have finished doing what I
want inside applicationWillFinishLaunching:, including
a modal dialog.

Upon receiving a notification that the first
AppleEvent will be processed, I install my own handler
for the "open documents" event.  If I process that
event prior to setting a flag at the end of
applicationWillFinishLaunching: I just put the file
URLs into a queue.  The app delegate also has to
return NO on a call to shouldOpenUntitledFile.

Once I've initialized, I just use some
NSDocumentController methods to open any queued files
or created an untitled document if there are no
documents.

No document objects are instantiated until all
initialization is complete - exactly what I wanted :)

Scott

--- Scott Lehman <email@hidden> wrote:

> Hi,
>
> I've got a Cocoa app that needs to perform
> initialization (loading plug-ins mainly) at startup
> and before a document is created.  The docs are
> pretty
> clear - I should do this in
> applicationWillFinishLaunching:.  But I want to
> display a dialog or alert when there's a problem in
> the initialization and that's where I've run into a
> problem.
>
> Simply calling NSRunAlertPanel seemed like a good
> choice, but while the modal loop is running, the
> event
> to open a document is processed.  I experimented
> with
> some performSelector: methods, to display the
> dialog,
> but then I seemed to miss the event to open the
> document completely.
>
> Is there a way to display a dialog/alert during
> applicationWillFinishLaunching: and not have a
> document open event processed until it returns?
>
> The only idea I have right now is to queue up all
> the
> errors and then process them in the openFile
> methods,
> but I'm guessing there's a better way.
>
> Thanks,
>
> Scott
>
>
>
>
____________________________________________________________________________________
> The fish are biting.
> Get more visitors on your site using Yahoo! Search
> Marketing.
>
http://searchmarketing.yahoo.com/arp/sponsoredsearch_v2.php
>




____________________________________________________________________________________
Don't pick lemons.
See all the new 2007 cars at Yahoo! Autos.
http://autos.yahoo.com/new_cars.html
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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

  • Prev by Date: Re: Seeing which page Safari is currently browsing
  • Next by Date: Return code of process given ID
  • Previous by thread: Re: Seeing which page Safari is currently browsing
  • Next by thread: Return code of process given ID
  • Index(es):
    • Date
    • Thread