Sign In/My Account | View Cart  

advertisement

AddThis Social Bookmark Button

Article:
  Animating Graphics in Cocoa, Part 1
Subject:   Archiving graphics
Date:   2002-01-20 14:29:24
From:   michele
Response to: Archiving graphics

Hello 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




Full Threads Oldest First

Showing messages 1 through 1 of 1.

  • Michael Beam photo Archiving graphics
    2002-01-23 21:08:29  Michael Beam | O'Reilly Author [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