Re: Opening a document from stationery
Re: Opening a document from stationery
- Subject: Re: Opening a document from stationery
- From: "Ashley Clark" <email@hidden>
- Date: Sat, 11 Oct 2008 01:03:43 -0500 (CDT)
- Importance: Normal
> 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 (email@hidden)
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:
This email sent to email@hidden