• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Opening a document from stationery
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Opening a document from stationery (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: How can be my application notified about user defaults changes?
  • Next by Date: Re: NSTableView and drag and drop
  • Previous by thread: Opening a document from stationery
  • Next by thread: Add animation layer and then remove animation layer
  • Index(es):
    • Date
    • Thread