| Article: |
Animating Graphics in Cocoa, Part 1 | |
| Subject: | Archiving graphics | |
| Date: | 2002-01-20 11:17:34 | |
| From: | mikebeam | |
|
Response to: Archiving graphics
|
||
|
you might want to look into converting this application into a document based application. When you say you "don't know how to tell the document that the view has changed after a mouse event has occured" do you mean to tell the document to redraw itself or to not let you close the document without asking you to save unsaved changes?
|
||
Showing messages 1 through 2 of 2.
-
Archiving graphics
2002-01-20 14:29:24 michele [Reply | View]
-
Archiving graphics
2002-01-23 21:08:29 Michael Beam |
[Reply | View]
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!
Mike




I mean not let me close the document without asking me to save unsaved changes.
I've already converted the application into a document based application, added synchronisation between colors (background and brush) and color wells as well as line width and line width slider on opening a document.
It works fine as long as I don't close the window or quit the application without closing a changed document.
Thanks for your help,
Michèle