Re: saveDocument newbie question
Re: saveDocument newbie question
- Subject: Re: saveDocument newbie question
- From: Neto <email@hidden>
- Date: Mon, 19 Jun 2006 12:10:45 -0300
Alan,
Thanks, your suggestion solves half of my problem...
The other half:
I have an array->arraycontroller->tableView.
I need to trigger an updateChangeCount when the array is edited.
I could do that using your suggestion for each NSTextField that edits
the Array keys...but I think it must be an easier way...just can't
find anything at the documentation...
Any ideas?
Thanks
n
On Jun 19, 2006, at 11:45 AM, Alan Smith wrote:
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