Animating Graphics in Cocoa, Part 1
Subject:   Archiving graphics
Date:   2002-01-23 21:08:29
From:   mikebeam
Response to: Archiving graphics

Ah, i see. You want to tell the document that you've made a change to something important and it shouldn't let you close the document window without providing some feedback that there are unsaved changes. This is actually pretty easy.

When you modify the document's data (I'm assuming the code that does this is in your NSDocument subclass) you want to use the NSDocument method
-updateChangeCount:. The argument to this is one of three constants: NSChangeDone, NSChangeUndone, and NSChangeCleared. So, in your method that modifies your data you would want to have executed is:

[self updateChangeCount:NSChangeDone];

This will mark your document as having unsaved changes. The reason for the complexity of this is to support the undo system. I hope i answered the correct question and that the answer was helpful.

BTW, i'm working on the your question about the tablecolumn thing from several, several columns ago. I think a future column will cover it, but if you want to know what i'm thinking feel free to email me and i'll share with you. Talk to you later!