• 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: Document-based app, import function
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Document-based app, import function


  • Subject: Re: Document-based app, import function
  • From: Mike Ferris <email@hidden>
  • Date: Tue, 22 Mar 2005 07:38:07 -0800

I am writing a document based application and I have been wondering how I was supposed to implement an "Import..." function.

Let's say my app is reading and writing ".aaa" files, but sometimes needs to read information from a ".bbb" file. My app can only read from those ".bbb" files, not write nor create them. I think this is pretty much the definition of the "Import..." no ?

So How should I do this? Should i put in the info.plist the ".bbb" or not ? Is there already something in the Cocoa-API that would allow me to do so or not ?

You can put the type in your Info.plist with the CFBundleTypeRole set to Viewer. You'll be able to open such files, but not save them. They will come up as unititled documents.

This is most appropriate if you can actually save them out as some other document type supported by your app.

See the NSDocumentFAQ release note for more details.

Last question, not completely related .... when I launch my document-based app, I always get a new document created at the beginning. Is there a way to have an "open..." window that would let me choose the document I want to open ?


You can implement -applicationOpenUnititledFile: in your application delegate. If you do this, then the NSDocumentController will not be asked to create an untitled doc since it will assume your delegate will have done the appropriate thing.

Mike Ferris

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Document-based app, import function (From: Julien Palmas <email@hidden>)

  • Prev by Date: Re: [OT] Job hunting
  • Next by Date: Re: Inspector window
  • Previous by thread: Document-based app, import function
  • Next by thread: Re: A 'small' NSMenu
  • Index(es):
    • Date
    • Thread