Priyatna Codes - My Programming Journey
 


You are here: Home Delphi Stuffs NiceSettings
NiceSettings Component

Version: 1.00
Release Date: June 8th, 2003

Introduction

NiceSettings is an easy and sophisticated way to add saving and restoring state capabilities to your Delphi applications. It can automatically save and restore form properties and components taking advantage from RTTI. All you have to do is specifying which properties are to be saved and restored.

Limitation: This component uses RTTI. So it only work with published properties of the form and it's components.

 

 

License

This library is released under Mozilla Public License. You can use it in your freeware, shareware or commercial softwares. You can send your modification to me, and if I decide to include it in the main distribution, I will add your name as a contributor. You can read full licensing information here.

 

Installation

There is no special process to install it on Delphi. Just open NiceSettingsD7.dpk on Delphi IDE and press Install button. I use Delphi 7. If you use another Delphi version, you may have to make some minor changes.

The component will appear in priyatna.org tab.

 

Usage

  1. Place an instance of TNiceSettings on a TForm.
  2. Fill StoredProperties (TStrings) property with appropriate value (see demo project).
  3. Call its LoadSettings method on FormCreate.
  4. Call its SaveSettings method on FormClose.

 

Methods & Properties

There are some methods and properties of the component:

  • procedure LoadSettings;
    Loads previously stored settings. Usually you call this method on FormCreate event.

  • procedure SaveSettings;
    Saves current settings. Usually you call this method on FormClose or FormDestroy event.

  • property StoredProps: TStrings;
    This is where you can specify which properties to be saved. One line for each property. You can also save children component properties using "component name + dot + property" format, for example "Memo1.Color", "Edit1.Text", etc.

  • property StoreTarget: TStoreTarget;
    Specifies where to save settings. Currently you have two options: stIniFile saves to an INI file, stRegistry saves to registry under HKEY_CURRENT_USER.

  • property RegKey: string;
    Specifies in which key branch the component will save the settings in the registry.

  • property IniFile: string;
    Specifies the name of INI file to use when saving settings.

 

Download

Download full source code and demo here:

NiceSettings.zip
238 KB

Version: 1.00
Release Date: June 8th, 2003