TXMLPropStorage

From Lazarus wiki
Revision as of 20:18, 9 March 2008 by Junior (talk | contribs)
Jump to navigationJump to search

Deutsch (de) English (en) español (es) français (fr) polski (pl) português (pt) русский (ru)

Introduction

TXMLPropStorage is a component to save and restore selected properties (either TForm or any control on it). It's work with TForm.SessionProperties property. It's available on Misc tab of component palette.

Usage

  1. Drop a TXMLPropStorage component on form and set filename property, for example: session.xml
  2. Select form, go to Object Inspector and open editor window for the SessionProperties property of TForm.
  3. Add here properties of form and/or controls to be stored inside session.xml (example: width;height).
  4. Compile the application.

Your application now will read selected property value from session.xml and apply it on runtime (like Width, Height, Left, Top for TForm).

TINIPropStorage component works the same way as TXMLPropStorage, except it stores the session information in an IniFile.

Notes

TXMLPropStorage has a default handler if you don't set a filename. Under Windows/MacOS the settings will be saved in the application directory as PROGRAMNAME.xml.

Under Unix likes it will be saved in the home directory of the current user as .PROGRAMNAME

It is therefore a very good idea to leave the filename blank for unix programs meant to be run by normal users.