On 27.01.2011, at 14:54, Bruce Cresanta wrote:

> Hello,
> 
>       I am trying to open an NSDocument based window.    My NSDocument class 
> follows the standard (MyDocument) class created using the automatic project 
> settings.   I do initialization in the awakeFromNib override within 
> MyDocument.
> 
> To create the document I use:
> 
> id myDocument = [[NSDocumentController sharedDocumentController] 
> makeUntitledDocumentOfType:@"DocumentType" error:&error];
> 
> The awakeFromNib initializations ARE SKIPPED in this call.

According to the documentation this method creates a new document by calling 
initWithType:error: in the NSDocument
subclass. Use NSDocumentController#openUntitledDocumentAndDisplay:error: and 
set the displayDocument parameter to YES. 
In your NSDocument subclass you should override windowControllerDidLoadNib: but 
I guess awakeFromNib will work fine ... 

<http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Documents/Articles/ObjectInteractions.html%23//apple_ref/doc/uid/TP40003196-SW2>
 shows the sequence for creating a new document

Cheers, 

felix

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to