• 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 - NSSaveOperation disables Save Menu Item
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSDocument - NSSaveOperation disables Save Menu Item


  • Subject: Re: NSDocument - NSSaveOperation disables Save Menu Item
  • From: Ricky Sharp <email@hidden>
  • Date: Wed, 7 Mar 2007 15:32:17 -0600


On Mar 7, 2007, at 2:44 PM, Denise Eatherly wrote:

Has anyone implemented saveAs directly on an NSDocument subclass?

I'd like to provide an option that gets a directory from the user & then saves a few auxiliary files into that directory and finally saves the currently active document into the directory as well. When this happens, it should act like a 'Save As' in that any future saves should affect the newly created file. As the user already provided the destination directory, the Save Panel shouldn't come up again. So, using NSDocument's saveDocumentAs: won't do it, as far as I can tell.

I've tried [ myDocument saveToURL:newURL ofType:myType forSaveOperation:NSSaveOperation error:&anError ]; Basically, it seems to work. However, once it executes, the Save item in the File menu becomes disabled. The document window correctly shows as edited when changes are made and if I try to quit, it brings up the panel reminding me that there are changes. Selecting Save at that point saves into the correct file. I have tried explicitly setting the document's fileURL and fileName after the save operation as well as updating the changeCount. No joy. Does anyone know what could be causing this? or what to do about it?

When you save a document to a directory, what exactly are the auxiliary files that are also saved next to it? Are they all related to that specific document, or are they shared amongst all documents saved to that particular directory?


If each document has its own set of aux files, I'd consider changing your app to work with document bundles. I believe coding would then be very straightforward (should be similar, if not identical to code that saves a single file). And, it will be easier for your users in case they want to move those documents around.

___________________________________________________________
Ricky A. Sharp         mailto:email@hidden
Instant Interactive(tm)   http://www.instantinteractive.com

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: 
 >NSDocument - NSSaveOperation disables Save Menu Item (From: Denise Eatherly <email@hidden>)

  • Prev by Date: Re: Comparing Run Logs?
  • Next by Date: Re: Comparing Run Logs?
  • Previous by thread: NSDocument - NSSaveOperation disables Save Menu Item
  • Next by thread: Comparing Run Logs?
  • Index(es):
    • Date
    • Thread