• 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: NSDocument without Save
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSDocument without Save


  • Subject: Re: NSDocument without Save
  • From: Sherm Pendley <email@hidden>
  • Date: Tue, 8 Feb 2011 21:46:43 -0500

On Tue, Feb 8, 2011 at 9:29 PM, Graham Cox <email@hidden> wrote:
> I'm trying to prevent NSDocument from doing any saving at all, for a demo version of my app. I need to suppress the menu commands (done) and all the automated UI such as the 'save changes' dialog and 'Save As' dialog even though the doc is marked dirty. I've also removed the actual save code.
>
> According to the docs for -canCloseDocumentWithDelegate:shouldCloseSelector:contextInfo:, if I immediately pass YES to the should close selector, it should accomplish this. Indeed, it does suppress the "do you want to save changes?" dialog, but the window does not close.
>
> What's the proper way to do this? I searched the archives but surprisingly I couldn't find any previous discussion of this, even though I would have thought it's quite a common thing.

If you've removed the actual save code, why not simply let Cocoa go
through the motions and call your (empty) save method? Seems like a
lot of unnecessary trouble to go through, just to make it avoid
calling a method that isn't going to do anything anyway...

sherm--

--
Cocoa programming in Perl:
http://camelbones.sourceforge.net
_______________________________________________

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

  • Follow-Ups:
    • Re: NSDocument without Save
      • From: Graham Cox <email@hidden>
References: 
 >NSDocument without Save (From: Graham Cox <email@hidden>)

  • Prev by Date: NSDocument without Save
  • Next by Date: Re: NSDocument without Save
  • Previous by thread: NSDocument without Save
  • Next by thread: Re: NSDocument without Save
  • Index(es):
    • Date
    • Thread