OWLNext 7.0
Borland's Object Windows Library for the modern age
|
Like most other objects, TDocument provides functions that let you safely close and destroy the object.
TDocument::~TDocument() does a lot of cleanup. First it destroys its children and closes all open streams and other resources. Then, in order, it
In addition to a destructor, TDocument also provides a TDocument::CanClose() function to make sure that it's OK to close. CanClose first checks whether all its children can close. If any child returns false, CanClose returns false and aborts. If all child documents return true, CanClose calls the document manager function FlushDoc, which checks to see if the document is dirty. If the document is clean, FlushDoc and CanClose return true. If the document is dirty, FlushDoc opens a message box that prompts the user to either save the data, discard any changes, or cancel the close operation.