• 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: saveDocumentAs: with a delegate?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: saveDocumentAs: with a delegate?


  • Subject: Re: saveDocumentAs: with a delegate?
  • From: publiclook <email@hidden>
  • Date: Thu, 23 Oct 2003 21:51:39 -0400

On Thursday, October 23, 2003, at 09:10 PM, Matthew Weinstein wrote:

I'm confused. I finally figured how to detect whether a file is saved via the delegate using saveDocumentWithDelegate:etc.:

Now I need to do the same detecting with saveDocumentAs: I tried using saveToFile: (with nil as the file) but it doesn't do anything; i.e., no save sheet. What am I doing wrong; how do I find my new document name after a saveAs? Ideas? (personally I hate that saveAs is asynchronous)

Asynchronous save dialogs (actually document modal dialogs) are a feature, but you don't have to use the feature. You can have application modal save dialogs, but user might think your application is "primitive".

Do I misunderstand ? Is there a problem with NSDocument's

fileName

- (NSString *)fileName

Returns the filename (as a fully qualified path) under which the receiver has been saved.

See Also: - fileNameFromRunningSavePanelForSaveOperation:, - setFileName:


You can have any method of the delegate called via the didSaveSelector: argument

saveToFile:saveOperation:delegate:didSaveSelector:contextInfo:

- (void)saveToFile:(NSString *)fileName saveOperation:(NSSaveOperationType)saveOperation delegate:(id)delegate didSaveSelector:(SEL)didSaveSelector contextInfo:(void *)contextInfo

Called after the user has been given the opportunity to select a destination through the modal save panel presented by runModalSavePanelForSaveOperation:delegate:didSaveSelector:contextInfo:. If fileName is non-nil, this method writes the document to fileName, sets the document's file location and document type (if a native type), and clears the document's edited status. didSaveSelector gets called with YES if the document is saved successfully, and NO otherwise.

didSaveSelector should have the following signature:


- (void)document:(NSDocument *)doc didSave:(BOOL)didSave contextInfo:(void *)contextInfo


In your method, call [doc fileName].
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >saveDocumentAs: with a delegate? (From: Matthew Weinstein <email@hidden>)

  • Prev by Date: Re: unconnected TextFields
  • Next by Date: Graphics "primitives" tutorial?
  • Previous by thread: saveDocumentAs: with a delegate?
  • Next by thread: Graphics "primitives" tutorial?
  • Index(es):
    • Date
    • Thread