Purpose of PtSettings
Requirement
The PtSettings idea was developed to make it much easier to :
access settings in code.
add a new settings.
load settings into memory.
save settings to file.
Uses
As it turns out, PtSettings not only fulfills its requirement, is more flexible than anticipated.
With PtSettings developers can also :
easily choose how and where to store settings.
send settings across networks.
hide access to the storage file from the rest of an application.
use different storages at will without changing the rest of the application
and more...
Technology
The technology behind PtSettings is similar to that of .dfm and .xfm files for forms in that RTTI is used to automatically read and write published properties. However, PtSettings is much more powerful as it is geared towards application settings and flexibility.
What it looks like
Properties are accessed by basically reading or writing properties in a structure of objects. Fetching a user name from settings could look like this :
edUserName.Text := Settings.User.Name;
Putting the position of a form into the settings could look like this:
Settings.GUI.MainForm.Rect := frmMain.BoundsRect;
To load or save settings from a storage (eg. Registry, XML file or .ini file) you simply call a method using a settings object as a parameter :
Storage.LoadAll( Settings );