Saver is a tool for adding state-saving and restoration features into any type of VFP application. This modular subsystem consists of a general purpose class library, core functions, generic dialogs, and a demo application. Two examples of real applications that use the Saver mechanism are XFormDBF and BTCrit (a custom form for constructing complex search criteria).
The concept of state-saving and restoration deals with a program's ability to remember the way it was last left. Terms like "user preferences", "default settings", "configuration", "persistence", etc. all really boil down to the same issue under various guises.
This topic is by no means exclusively related to VFP, but VFP happens to be especially adept at state-saving and restoration. Assorted approaches have been discussed in the literature and used in applications, including VFP itself, as well as many non-VFP products. The FoxPro Foundation Classes (FFC) include a rudimentary Object State class to save and/or restore object property settings automatically or explicitly. A popular practice, which Microsoft encourages, is to save the most recent settings for each application in the Windows registry, later restoring these settings when the application is next launched. Doug Hennig's article, "Persistence Without Perspiration", in the January 2000 issue of FoxTalk describes a general approach integrated with the FFC's registry manipulation class, which can be adapted to support alternative repositories.
More prevalent than such general approaches, however, are applications that have their own specialized ways of dealing with saved states, typically using custom "INI" files or tables specific to those programs. And of course the VFP Development System relies on its own peculiar "resource" files to keep track of window layouts, column arrangements, font settings, and a slew of other details about the most recent user preferences.
Saver combines VFP's powerful object-oriented programming model, native database support, and dynamic command processing capabilities to provide a flexible, general approach to state-saving and restoration that can cope with very complex applications. When an application's state or "configuration" is saved, a Commander-based state-restoration function is generated and stored in a table, referred to as a "metafile". Executing a state restoration function returns an object to its previous state.
An unlimited number of different configurations, even those belonging to different Saver-based applications (which may be nested or recursive), can be stored in one or more such meta-files. Saver supports several ways of annotating saved states, and it provides commands for saving, restoring, copying, and switching between different configurations, as well as optional automatic state-saving and restoration features.