• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Custom "Save changes?" - overriding canCloseDocument...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: Re: (long) All these newbie questions that are answered by documentation
  • Next by Date: Nibtool for translation
  • Previous by thread: Re: Threading, save panels, and segfaults
  • Next by thread: Nibtool for translation
  • Index(es):
    • Date
    • Thread