> I want to implement opening a document from stationery. This opens a
> new 'untitled' document but preloaded with the content from the
> template file. It's pretty much working using the following code:
>
>       NSDocument* newDoc = [[NSDocumentController sharedDocumentController]
> openDocumentWithContentsOfURL:url display:YES error:&outError];
>
>       [newDoc setFileURL:nil];
>
> But you can see the window title briefly display the original filename
> before being set to 'untitled'. To try and fix that I tried passing NO
> in the display: parameter, then calling -showWindows after setting the
> URL to nil, but that doesn't show anything at all.
>
> So, what's the right way to handle this?

Make sure that you're calling makeWindowControllers on your document
instance before you try and showWindows.

You might also look at -makeDocumentForURL:withContentsOfURL:ofType:error:
and then adding that document to the document controller?

-- 
Ashley Clark

_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to