Matt S.
Matt S.

Reputation: 13753

NSWindow display alert when attempt to close

How can I display an NSAlert when an NSWindow attempts to close? This will also have to be turned on and off.

Upvotes: 0

Views: 1011

Answers (1)

Chuck
Chuck

Reputation: 237060

NSWindow's delegate has a windowShouldClose: method that will allow you to customize this. There's also NSWindow's documentEdited methods that let you mark a document as having unsaved changes, which might interest you.

Upvotes: 1

Related Questions