hcOPF building blocks - Application Settings
November 2nd, 2020I just checked in some additional code to provide database driven hierarchical Program Settings using the hcOPF framework for data access. The Settings code can be found under the Source/UI/Common/Settings folder for domain objects and other non-visual code, including database scripts for Firebird. The actual program Settings dialog is located in Source/UI/VCL and only a VCL version is available at this time.
It should be simple to incorporate this into a VCL application, especially one already using Firebird. If you run the Application Settings.sql script it should create all the necessary database structures. Then you need to populate the SettingsCategory and Settings tables. To integrate the ProgramSettings dialog, use the unit and call it’s Execute method with the Settings list and current security level. Keep in mind that the settings key value must be unique across all settings. While a path like key may work, if you re-organize the setting hierarchy the key will no longer make sense.
At some point I would like to provide a “Designer” mode into the Dialog that would allow you to interactively create or modify the setting hierarchy. For now, scripts to build it will have to suffice. Keep in mind that this is the first release of code I wrote a long time ago. It has worked well for the last 10 years, but it needs to be tightened up (more database constraints, a review of code for better performance/less overhead). When time permits I intend on improving it for use on future projects.