Difference between revisions of "TXMLPropStorage"

From Free Pascal wiki
Jump to navigationJump to search
m
Line 1: Line 1:
 
{{TXMLPropStorage}}
 
{{TXMLPropStorage}}
  
'''TXMLPropStorage is a component to save/restore selected properties (either TForm or any control on it)
+
== Introduction ==
Works with TForm.[[doc:lcl/forms/tform.sessionproperties.html|SessionProperties]] property.'''
 
  
Usage:
+
TXMLPropStorage is a component to save and restore selected properties (either TForm or any control on it). It's work with TForm.[[doc:lcl/forms/tform.sessionproperties.html|SessionProperties]] property. It's available on '''Misc''' tab of component palette.
# Drop a [[doc:lcl/xmlpropstorage/txmlpropstorage.html|TXMLPropStorage]] component on form and set filename, for example: session.xml
+
 
# Open editor window for the [[doc:lcl/forms/tform.sessionproperties.html|SessionProperties]] property of TForm.
+
== Usage ==
# Add here properties of form and/or controls to be stored inside session.xml.
+
# Drop a [[doc:lcl/xmlpropstorage/txmlpropstorage.html|TXMLPropStorage]] component on form and set filename property, for example: session.xml
 +
# Select form, go to Object Inspector and open editor window for the [[doc:lcl/forms/tform.sessionproperties.html|SessionProperties]] property of TForm.
 +
# Add here properties of form and/or controls to be stored inside session.xml (example: width;height).
 
# Compile the application.
 
# 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)
+
Your application now will read selected property value from session.xml and apply it on runtime (like Width, Height, Left, Top for TForm).
 
 
TINIPropStorage works the same way as TXMLPropStorage, except it stores the session information in an ini-file.
 
  
 +
TINIPropStorage component works the same way as TXMLPropStorage, except it stores the session information in an [http://lazarus-ccr.sourceforge.net/docs/fcl/inifiles/index.html IniFile].
  
'''A note on filenames'''
+
== Notes ==
  
 
TXMLPropStorage has a default handler if you don't set a filename.
 
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 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
 
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.
 
It is therefore a very good idea to leave the filename blank for unix programs meant to be run by normal users.

Revision as of 20:18, 9 March 2008

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.