Suppressing the "Couldn't save document" sheet
Suppressing the "Couldn't save document" sheet
- Subject: Suppressing the "Couldn't save document" sheet
- From: Mark Alldritt <email@hidden>
- Date: Wed, 13 Apr 2005 10:40:47 -0700
Hello All,
What is the correct way to prevent the "Couldn't save document" sheet from
appearing? I have several cases where I cannot save a document and I want
to offer the user alternatives of my own.
For example, since my app creates applications, its possible for my user to
try and save over a running application. I want to (a) warn the user they
are saving over a running app and (b) offer to quit the app and proceed with
the save.
Since I'm using sheets for all this and I detect problems like this in the
NSDocument writeToFile:... method, I must return NO after posting my alert
sheet. At that point, Cocoa insists on showing the "Couldn't save document"
sheet once my sheet(s) have been dismissed.
I've found that I can suppress the "Couldn't save document" sheet by raising
an exception from writeToFile:.., but this seems like it might cause
problems as the exception is logged as uncaught.
I've received suggestions that I look at the TextEdit sample code for
solutions to my document saving problems, but TextEdit does not use
NSDocument so its not terribly helpful.
Cheers
-Mark
------------------------------------------------------------------------
Mark Alldritt Late Night Software Ltd.
Phone: 250-380-1725 Script Debugger 3.0 - AppleScript IDE
WEB: http://www.latenightsw.com/ Affrus 1.0 - Perl Debugging
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden