• 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: Writing a non-NSDocument based multiple document window apps
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Writing a non-NSDocument based multiple document window apps


  • Subject: Re: Writing a non-NSDocument based multiple document window apps
  • From: Steve Palmer <email@hidden>
  • Date: Sun, 14 Mar 2004 04:25:34 -0800

Thanks Scott. That was what I strongly suspected but it seemed reasonable to double check that I wasn't doing it the hard way.


On Mar 13, 2004, at 10:36 PM, Scott Anguish wrote:

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.
_______________________________________________
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.


  • Follow-Ups:
    • Re: Writing a non-NSDocument based multiple document window apps
      • From: Steve Palmer <email@hidden>
References: 
 >Writing a non-NSDocument based multiple document window apps (From: Steve Palmer <email@hidden>)
 >Re: Writing a non-NSDocument based multiple document window apps (From: Scott Anguish <email@hidden>)

  • Prev by Date: Cocoa Game Development Book
  • Next by Date: Formating a number in a string
  • Previous by thread: Re: Writing a non-NSDocument based multiple document window apps
  • Next by thread: Re: Writing a non-NSDocument based multiple document window apps
  • Index(es):
    • Date
    • Thread