AutoSave
Volume Number: 6
Issue Number: 5
Column Tag: MacOOPs!
USavedMe Auto-Save Class
By Fred Condo Jr., Covina, CA
Note: Source code files accompanying article are located on MacTech CD-ROM or
source code disks.
An Auto-Saving Document Class
[Fred Condo Jr. is a doctoral student of information science at the Claremont
Graduate School.]
This article presents a new abstract document class for MacApp,
TAutoSaveDocument, which allows the user to specify an interval after which the
document automatically saves itself. Such a feature is useful in applications, such as
word processing, in which a user is likely to make extensive changes to a document and
lose track of time; this feature is definitely not good in applications where the user is
likely to want to back out of changes with a Revert command.
TAutoSaveDocument is a subclass of TDocument, which MacApp defines. To use
TAutoSaveDocument, you simply make your document class a subclass of it; even a
completed MacApp application can be converted to use auto-saving documents in a
matter of minutes. This speedy conversion is one of the benefits of object-oriented
programming and MacApp.
Design considerations
I designed USavedMe, the Pascal unit that embodies TAutoSaveDocument, with the
following results (some interrelated) in mind:
• Auto-saving should impose a minimal encumbrance on the end user.
• The interface to auto-saving should be through a modeless dialog.