I need to programmatically save the active document of an NSDocument based app from within a method of the NSViewController that controls the document view. Menu items do this by sending save() to the first responder. What is the best way to do this programmatically? Should I A) get a reference to the NSDocument (somehow) and then call the save method or B) send a save: message to the first responder?
2
votes
It depends on why and from where you want to save.
- Willeke
From an NSViewController - I've updated the question with more details.
- Mike T
Are you just trying to trigger an autosave or do want to create a new Version (you know, triggered when the user uses the Save command)?
- Bob
I want a new version - just like when the user selects File->Save from the menu.
- Mike T