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: one document at a time



On Dec 14, 2004, at 5:07 PM, Jiri Volejnik wrote:

I need to modify my app so that only one document at a time can be opened. If there is some document already opened, it should be closed and its windows reused. What way would you suggest to go? I was thinking about subclassing NSDocumentController, but maybe it's not necessary?

Well, before anything, I'd suggest you think through this. As an end user, I find the one-document restriction annoying in most applications that use it. I have trouble seeing why Quicktime Player allows multiple movies, but Windows Media Player allows only one, for example. There are some cases where it seems to make sense, though.


So, if you're sure it's the right thing to do, I would suggest that the easiest thing is to simply gray the "new document" menu item when a document is opened or created, and enable it when there a document is closed. With the "open document" option, you should ask to save, close without saving, or cancel before presenting the standard open dialog.

This requires a relatively minimal amount of code, and is fairly easy to back out should you decide to support multiple documents in the future.


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >one document at a time (From: Jiri Volejnik <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.