I found a major problem with the architecture of my Document based app. Basically a store the model (a simple string) in a global variable, every time the text in field changes. I have the document save this string as it's data, and restore re-opened files using this data.
Now, the major problem that I now see is that if I restore any saved file, I populate the global variable from the document in the documents "readFromData" function (works).
But if I create a new document, "readFromData" is never called, so I have no way to set the global string to "", and thus my new documents global variable is still populated with the last saved string. (I use this to put the string back into the text view on load.
So as a simple workaround, I would need to be able to use a function that is automatically called and only ever called by the creation of a new document, to set my global variable back to "".
I can not find such a function I can override. Does one exist..?