Instance Property

documentEdited

A Boolean value that indicates whether the window’s document has been edited.

Declaration

@property(getter=isDocumentEdited) BOOL documentEdited;

Discussion

The value of this property is YES when the window’s document has been edited; otherwise, NO. Initially, by default, NSWindow objects are in the “not edited” state.

You should set documentEdited to YES every time the window’s document changes in such a way that it needs to be saved. Conversely, when the document is saved, you should set the property to YES when the window’s document has been edited; otherwise, NO. Then, before closing the window you can examine the value of the property to determine whether to allow the user a chance to save the document.