Re: saveDocument newbie question
Re: saveDocument newbie question
- Subject: Re: saveDocument newbie question
- From: "Alan Smith" <email@hidden>
- Date: Mon, 19 Jun 2006 10:45:40 -0400
Hi Neto,
If you're using NSDocument, that is if you're app in an editor of some
sort like TextEdit, there already is a method the will save the file
before quiting. Enter updateChangeCount:.
Using code like this you're app will save all unseaved changes, normally.
- (IBAction)textWasEnteredInTextView:(id)sender
{
[self updateChangeCount:NSChangeDone];
}
If you hooked that up as the action of a NSTextView in your
MyDocument.nib file (or whatever you're calling it) it will put that
familiar dot in the red close button of your window. When that window
is closed, even if the app is quitting, the user will be asked if they
want to save it. Note that that method (textWasEnteredInTextView) will
have to be in your NSDocument.m file (or whatever you're calling your
NSDocument subclass).
Check out (http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSDocument_Class/Reference/Reference.html#//apple_ref/doc/c_ref/NSDocumentChangeType)
for more information on this NSDocument method (updateChangeCount).
I hope this helps, Alan
--
// Quotes from yours truly -------------------------
"You don't forget, you just don't remember."
"Maturity resides in the mind."
"Silence is the Universe's greatest gift."
"Don't waste your life doing things others have already done."
_______________________________________________
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