Re: Disabling menu items
Re: Disabling menu items
- Subject: Re: Disabling menu items
- From: Uli Kusterer <email@hidden>
- Date: Sat, 16 May 2009 09:37:26 +0200
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 (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