Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multiple Document Types




On Oct 29, 2005, at 9:07 PM, Thom McGrath wrote:

I'm trying to implement a three document type structure. This is a sample of one of the methods used to create a document simply known as "MyClass" in the example. This class is also the default, so in essence, I'm trying to mimick the default behavior.

The result is a usable class. But no window appears for it. Why? I would love to use the simpler openUntitled... methods, but those have been depreciated. What simple step am I missing? It should be noted that I do get a default window upon application launch, so my window outlet *is* connected properly.

NSDocumentController *controller = [NSDocumentController sharedDocumentController];
NSError *outError = nil;
MyClass *me = [controller makeUntitledDocumentOfType:@"MyClass" error:&outError];
if (me != nil) {
[me showWindows];
[controller addDocument:paper];
} else {
NSAlert *alert = [NSAlert alertWithError:outError];
[alert runModal];
}

It's not entirely clear what you're doing here.
Is the code above in a method of a subclass of NSDocument?
There should be no need for this. An appropriate instance will be created and opened automatically if you have set up the document descriptions correctly in Xcode. If you need a means to create new instances of specific classes, create a custom subclass of NSDocumentController.


See <http://developer.apple.com/documentation/Cocoa/Conceptual/ Documents/Concepts/RolesOfDocObjects.html#//apple_ref/doc/uid/20000025>
<http://developer.apple.com/documentation/Cocoa/Conceptual/Documents/ Tasks/SubclassController.html#//apple_ref/doc/uid/20000953>
<http://developer.apple.com/documentation/Cocoa/Conceptual/Documents/ Concepts/DocTypePList.html#//apple_ref/doc/uid/20000024-BHADAGHF>
etc.


mmalc

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Multiple Document Types (From: Thom McGrath <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.