Skip navigation.
 
mlRe: NSDocument - preventing incomplete document from being saved
FROM : Lon Giese
DATE : Fri Jun 02 09:11:08 2006

> Have you some reason not to pass NO as the shouldClose: parameter of
> the shouldCloseSelector:?
>
>  -- F


Yes, cause the

canCloseDocumentWithDelegate:shouldCloseSelector:contextInfo:

opens up a save panel.

I need to verify the document is savable before giving the user the
choice to save, and open my own panel explaining what needs to be done
before the document can be saved.

canCloseDocument:

would be a perfect solution, but has been deprecated and is not called
when the user quits. and the run window in xcode prints out a nasty
gram every time the method is called.

I can think of some work a rounds, but has Cocoa's document
architecture anticipated this situation? My application is going to
have almost a hundred document types and I would like a nice clean
solution to this if possible.

Thanks
Lon


WooHoo the ultimate Mac App for 'The Sims 2' power users.
http://www.modthesims2.com/showthread.php?p=1239629
On Jun 1, 2006, at 10:52 AM, Fritz Anderson wrote:

> On 29 May 2006, at 12:42 PM, Lon Giese wrote:
>

>> What's the best way to prevent document closure when the document is
>> in an incomplete state?
>>
>> I have tried overriding NSDocument's
>> canCloseDocumentWithDelegate:shouldCloseSelector:contextInfo:
>>
>> but this is overly complicated because the main thrust of this method
>> is to let the user decide if he wants to save the document.
>>
>> canCloseDocument
>>
>> is very good, but it has been deprecated and is not called when
>> quitting the app (only widow closing) under 10.3.
>> How does the document architecture allow the programmer to decide if
>> a document should be closed? I just need a simple way to return NO if
>> the document is incomplete.

>
> Have you some reason not to pass NO as the shouldClose: parameter of
> the shouldCloseSelector:?
>
>  -- F
>

Related mailsAuthorDate
mlNSDocument - preventing incomplete document from being saved Lon Giese May 29, 19:42
mlRe: NSDocument - preventing incomplete document from being saved Fritz Anderson Jun 1, 19:52
mlRe: NSDocument - preventing incomplete document from being saved Lon Giese Jun 2, 09:11