Custom "Save changes?" - overriding canCloseDocument...
Custom "Save changes?" - overriding canCloseDocument...
- Subject: Custom "Save changes?" - overriding canCloseDocument...
- From: Dan Bernstein <email@hidden>
- Date: Sat, 10 Nov 2001 13:51:01 +0200
I want my NSDocument subclass to override
canCloseDocumentWithDelegate:shouldCloseSelector:contextInfo: in order
to replace the "Do you want to save changes...?" alert with different
phrasing and options (for example, see how Terminal.app or Mail.app
behave when you try to close a dirty window).
According to the docs, the default implementation displays the alert
sheet, and after the user makes a choice, calls the delegate's
shouldCloseSelector with an appropriate value. My problem is, of course,
that the method that handles the user's response to the sheet (the
didEndSelector) doesn't know what delegate and selector were given to
canCloseDocumentWithDelegate:.
I can find a way to stick this in the contextInfo, but that seems ugly.
How is this supposed to be done? Better yet, how does the default
implementation do it?
TIA,
--
Dan Bernstein