I have a document-based Cocoa app that uses a secondary NSWindow
for a preview mode (with shouldCloseDocument
set to NO
).
If the document is dirty (edited without saving) and I close the secondary NSWindow
, a "Do you want to save the changes made to the document" prompt appears.
How can I avoid this prompt on the secondary NSWindow
?
I couldn't find a way to do this. I expected to find a NSWindowDelegate
or NSWindow
method called before the save prompt but none of the obvious candidates (windowWillClose
, close
, performClose
, windowShouldClose
) are.
As a workaround, instead of setting NSWindowController.document
I'm using a custom property to pass the document. With document
set to NIL
, the save prompt is not shown anymore.