Re: nsdocument/nsapp delegate question
Re: nsdocument/nsapp delegate question
- Subject: Re: nsdocument/nsapp delegate question
- From: "John C. Randolph" <email@hidden>
- Date: Mon, 1 Oct 2001 22:45:38 -0700
On Monday, October 1, 2001, at 09:54 PM, Alex Rice wrote:
Hi, I have Cocoa design problem I need some advice around. I would like
my NSDocument app to do something like this- in pseudo code:
if launched via app icon
if user preference, open previous document
else create untitled doc
else if launched via a saved document
open only that document
Where I'm stuck is that I need find out in
applicationWillFinishLaunching: whether or not the app was launched via
a document or via the app. But, application:openFile: is not sent until
after applicationWillFinishLaunching: and by the time
applicationDidFinishLaunching: is sent, there is already an untitled
document opened automatically. How else can I check how the app was
launched via a document?
I think you can get the behaviour you describe just by implementing
-applicationShouldOpenUntitledFile: in your app delegate. That
shouldn't get called until the app is finished launching.
-jcr
"I fear all we have done is to awaken a sleeping giant and fill him with
a terrible resolve." -Admiral Isoroku Yamamoto, Dec 7, 1941.