Re: Writing a non-NSDocument based multiple document window apps
Re: Writing a non-NSDocument based multiple document window apps
- Subject: Re: Writing a non-NSDocument based multiple document window apps
- From: Scott Anguish <email@hidden>
- Date: Sun, 14 Mar 2004 01:36:11 -0500
On Mar 14, 2004, at 12:53 AM, Steve Palmer wrote:
I have an application that started life as a non-NSDocument based
Cocoa application. It has one main window in which all activity occurs
and a single MainMenu.nib that includes the menu, the main window and
some sheets. The application manipulates a SQL database.
Now I want to evolve this application so that I can have multiple
occurrences of the main window, and also some secondary windows for
editing individual data items. In other words, make it more document
oriented. It seems that I have two approaches:
1. Make the application NSDocument based.
2. Fudge some NSDocument style behaviour with the help of
NSWindowController, etc.
What would folks recommend? If option 1 is preferable, are there any
documented steps to converting a non-NSDocument app to a NSDocument
app? I appreciate there is more than just changing the main app base
object from NSObject to NSDocument.
1. is so much more preferable in most cases that it isn't even funny.
There isn't really any documented steps to it... you'd need to move
any initialization code for .nib stuff into the NSDocument subclass's
windowControllerDidLoadNib: implementation.
You'll need to make sure that any global variables that shouldn't be
are also migrated into the NSDocument, along with your model storage.
any menu/UI validation code will need to move to the NSDocument
subclass, and you'll need to have menu items that you've wired up
yourself that don't interact with firstResponder switch to that design.
Because you're implementing an SQL database, (and what exactly that
means I don't know in this case) you may need to consider the issues of
saving/opening documents (if you even have such a notion).
I'd strongly suggest starting a new project and moving the old code to
that, rather than trying to do it the other way around.
_______________________________________________
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.