On 15.05.2009, at 19:05, Quincey Morris wrote:
A better approach would be for your NSDocument subclass instances to check, in initWithType: or one of the ReadFrom... methods, if a document already exists (via [NSDocumentController documents]), and simply return an error if so. [Actually, since NSDocumentController has lousy error reporting, you should report the error yourself with something like [NSApp presentError:] and return a "user cancelled" error to suppress the standard NSDocumentController complaint.]


Actually -- an even better approach would be to do like all other apps and not present an error, but rather close the previous document and open the new one, because that is very likely what the user wanted. Just make sure you ask to save changes if needed and to not continue if the user cancels there.

When in doubt, assume that the user wanted to do something sensible, at least unless you run the risk of data loss.

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de





_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to