• 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: Simple menu-action question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Simple menu-action question


  • Subject: Re: Simple menu-action question
  • From: Graham Cox <email@hidden>
  • Date: Mon, 31 Mar 2008 13:58:53 +1100

I'm not sure if using Core Data would make a difference, but I'd just do this by responding to the menu command by putting up an NSOpenPanel then processing the filename it returns appropriately. I don't think there's any magic "proper" way to do this within the document architecture, except for...

Just list the file types (UTIs) that you can open in your info plist and map them to different NSDocument subclasses (if indeed a different document type is used for each different file type) or map different UTIs to the same class and differentiate the file type passed in the document's -readFromURL:ofType:error: method. This latter approach means you don't even need an "Import" menu, it just integrates into the existing Open file menu, which is more user friendly in my book - it "just works" rather than the user having to worry about what "Import" really means and whether, why and when they need to use it.


------ S.O.S.



On 31 Mar 2008, at 10:57 am, Rick Mann wrote:
In the mishmash of Cocoa tutorials and other docs I've read, I never seem to be led through the fundamentals. With Cocoa doing so much basic stuff for me, and Xcode stationery doing a bunch more, a few things seem to fall through the cracks.

I have a pretty straightforward document application (using Core Data). I want to add an "Import" command to the File menu. What's the right way to go about this? I figure it's very similar to how Open works, but since so much of Open is already implemented by the base classes, etc, it's hard to know how to duplicate it.

Any suggestions on an example to study? Thanks!

--
Rick

_______________________________________________

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

_______________________________________________

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


  • Follow-Ups:
    • Re: Simple menu-action question
      • From: Rick Mann <email@hidden>
References: 
 >Simple menu-action question (From: Rick Mann <email@hidden>)

  • Prev by Date: Re: Threads and Core Data, bindings results in view corruption
  • Next by Date: unpacking binary data
  • Previous by thread: Simple menu-action question
  • Next by thread: Re: Simple menu-action question
  • Index(es):
    • Date
    • Thread