Skip navigation.
 
mlRe: To Document-Base or not Document-Base...
FROM : Mike Ferris
DATE : Fri Jan 03 18:28:49 2003

> I am not sure if I should make my application document-based or not. It
> doesn't handle documents in the normal way, persay. There is a central
> database per user that takes care of loading and unloading settings and
> "documents" (that aren't really individual documents... this is hard to
> explain) automatically. It isn't like TextEdit where its main window
> revolves around typing and formatting and saving/opening/printing, etc.
> However, there WILL be windows for typing in contents of things such as
> emails, notes, etc.
>


NSDocument is not perfectly suited for dealing with "documents" whose
contents do not come from disk files, but it is not totally unsuited
for it either.  I would say it's basically a toss-up whether you'd be
better off subclassing and overriding enough behavior to make
NSDocument work for you or to just redo it yourself...

> So, the final question is: should I create my project as a
> document-based
> app in PB, or should I just have a normal application. Oh, also, I
> want to
> have complete control over which window appears at the startup of the
> application (it won't be a main window or anything). In a
> document-based
> app, I think I can overload
> - (BOOL)applicationShouldOpenUntitledFile:(NSApplication
> *)theApplication
> in my application delegate, but I haven't test to see if it actually
> keeps
> Cocoa from automatically opening windows at startup or not.
>
>

Whether you create the project from one template or another won't have
much affect in the long run.  There's nothing magic about project
templates and the difference between the Cocoa App and the Cocoa
Doc-based App is that the doc-based one includes a starter NSDocument
subclass and some extra Info.plist goop.

-applicationShouldOpenUntitledFile: will be consulted for doc-based
apps and if it returns NO, then no document will be created. 
-applicationOpenUntitledFile: will also be called, if it is there
instead of letting NSDocumentController handle creating a new document.

Mike
_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

Related mailsAuthorDate
mlTo Document-Base or not Document-Base... mw Jan 3, 16:02
mlRe: To Document-Base or not Document-Base... Mike Ferris Jan 3, 18:28
mlRe: To Document-Base or not Document-Base... mw Jan 3, 18:43
mlRe: To Document-Base or not Document-Base... Alex Rice Jan 3, 18:52
mlRe: To Document-Base or not Document-Base... Chris Hanson Jan 3, 22:41
mlRe: To Document-Base or not Document-Base... mw Jan 4, 14:41