• 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: Disabling menu items
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Disabling menu items (From: "McLaughlin, Michael P." <email@hidden>)
 >Re: Disabling menu items (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: Help with drawing
  • Next by Date: System Preference like App
  • Previous by thread: Re: Disabling menu items
  • Next by thread: Question about NSURLConnection and cache(ing)
  • Index(es):
    • Date
    • Thread