Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Simple menu-action question



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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Simple menu-action question (From: Rick Mann <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.