New document does NOT open at program start!
New document does NOT open at program start!
- Subject: New document does NOT open at program start!
- From: James Derry <email@hidden>
- Date: Thu, 24 Oct 2002 21:06:06 -0400
Hi all,
This isn't a reiteration of the "how do I prevent untitled windows from
opening" I've seen so many times when searching the archives. Actually, I
have the opposite problem! I cannot get my little app to make a new,
untitled document open at program start! Here's what I got:
MyDocument, a stock NSDocument subclass, with the correct nib name and all.
The nib is normal, as far as my capacity to tell. I know the default is for
an application to create a new untitled document, but I went ahead and
created a delegate class that implements "applicationShouldOpenUntitledFile"
forced to YES, but the problem persists.
If I create a new Cocoa Document based application, it works fine. I've
compare the "bare," working app with mine, and can't see any differences!
When I trace through the debugger, the delegate
"applicationShouldOpenUntitledFile" DOES get called, and returns YES. But in
my particular, non-working "MyDocument" class, I never reach "init" nor
"windowControllerDidLoadNib", so I'm sure that somewhere something is
refusing to even try create the MyDocument. Once the app is launched,
though, I can successfully create a new document in File/New.
This is frustrating, and I know I did something wrong. I was starting to
feel really good about my transition from Delphi! Anyone have any ideas as
to what I should check for?
Also, now that I think of it, how does the application know what document to
create at startup? Does it just go looking for all of the linked-in
NSDocument subclasses and pick the first one? I.e., if I wanted to create a
MyNewDocument class, what would I have to do to force NSApplication to
choose one instead of the other? This is mostly a hypothetical question, but
relevant, as I have no idea what ties what together. I know that
MyDocument.nib and class are tied together via windowNibName and File's
Owner, but how does MainMenu or NSApplication know about MyDocument class?
Again coming back to just searching for all linked-in NSDocument subclasses?
Whew, sorry for the long newbie type question! Thanks!
Jim Derry
--me
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.