Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Suppressing NSDocument's "unsaved changes" alert



Jeremy,

To disable the default close/save alert panel you will want to override the method

- canCloseDocumentWithDelegate:shouldCloseSelector:contextInfo:

in NSDocument, and not call super's implementation. Just throw up your own dialog and call the shouldCloseSelector depending.

~Martin


On June 28 2004, Jeremy Dronfield <email@hidden> wrote:

>This seems like it should be easy, but I can't find a solution. I have
>a document-based application in which each document (representing a
>project) manages its constituent source files in a manner similar to
>Xcode. When the user tries to close the document window or quits, they
>are (or should be) presented with a "Save All" window which lists any
>unsaved files (again, similar to Xcode).
>
>The problem is that NSDocument's default alert panel always butts in,
>and I can't find a way to disable it. I've burrowed through the chain
>of methods called during window closing and application termination,
>but can't find any point at which I can choke this wretched little
>panel. Is there a way to do this, or am I going to have to go back and
>rewrite my application without the Cocoa document architecture?
>
>Regards,
>-Jeremy
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.