• 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
Multi-Doc App with custom save panel
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Multi-Doc App with custom save panel


  • Subject: Multi-Doc App with custom save panel
  • From: Sarat Kongara <email@hidden>
  • Date: Wed, 6 Jul 2005 12:16:45 -0700

Hi,
I using the cocoa multi-document architecture but like to customize
the save panel which provides the user a set of locations where the
file can be saved. These locations are logical folders, the actual
data is saved in the ~/Library/Application Support folder.

To achieve this I am implementing two methods in my NSDocument subclass.

- (IBAction)saveDocument:(id)sender;

- (void)saveDocumentWithDelegate:(id)delegate
didSaveSelector:(SEL)didSaveSelector contextInfo:(void *)contextInfo;

The saveDocument method is called  when the user selects the Save menu
(command+S).

The saveDocumentWithDelegate:... method is called when the user closes
the document window or quits the application and the document has
unsaved changes.

The documentation for saveDocumentWithDelegate: says

Saves the document. If an NSSaveOperation can be performed without
further user intervention (at the very least, neither fileURL nor
fileType return nil), then the method immediately saves the document.
Otherwise, it presents a Save panel to the user and saves the document
if the user approves the panel. When saving has been completed or
canceled, the method sends the message selected by didSaveSelector to
the delegate, with the contextInfo as the last argument.

The didSaveSelector callback method should have the following signature:

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

As I am creating my own save panel in this method, I need to call the
didSaveSelector on the delegate after the user selects Save or Cancel
in the save panel.

How do I call the method on the delegate?
performSelector:withObject:withObject? But the second argument of the
callback is a BOOL and not an object.

In a nutshell two questions.
1. Am I implementing the correct methods?
2. If yes, how to invoke the callback in the saveDocumentWithDelegate: method.

Any help is really appreciated.

Regards
Sarat
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: Referencing an instance variable in a class method
  • Next by Date: Need to know more about core Image (Newbie )
  • Previous by thread: Re: Referencing an instance variable in a class method
  • Next by thread: Need to know more about core Image (Newbie )
  • Index(es):
    • Date
    • Thread