[Overview][Classes][Procedures and functions][Index] Reference for unit 'XMLPropStorage' (#lcl)

TXMLPropStorage

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Implements a class for XML storage of Form Session properties.

Declaration

Source position: xmlpropstorage.pas line 62

type TXMLPropStorage = class(TCustomXMLPropStorage)

published

  property StoredValues: TStoredValues;

  

Collection with the names and values for properties handled for the container.

  property FileName: string;

  

Name of the file where the property data is saved in XML format.

  property RootNodePath: string;

  

Path to the root node in the XML file.

  property Active: Boolean;

  

Indicates whether the container is Active and allows access to its storage.

  property OnSavingProperties: TNotifyEvent;

  

Event handler signalled when the Save method is started.

  property OnSaveProperties: TNotifyEvent;

  

Event handler signalled when the Save method is completed.

  property OnRestoringProperties: TNotifyEvent;

  

Event handler signalled when the Restore method is started.

  property OnRestoreProperties: TNotifyEvent;

  

Event handler signalled when the Restore method is completed.

end;

Inheritance

TXMLPropStorage

  

Implements a class for XML storage of Form Session properties.

|

TCustomXMLPropStorage

  

Implements the base class for XML storage of Form Session properties.

|

TFormPropertyStorage

  

TFormPropertyStorage - class for storage of a Form's properties.

|

TControlPropertyStorage

  

Implements the abstract ancestor class used to get the property list for a control.

|

TCustomPropertyStorage

  

Defines a container used to Save and Restore property values.

|

TComponent,IUnknown,IInterfaceComponentReference

|

TPersistent,IFPObserved

|

TObject

Description

TXMLPropStorage is a TCustomXMLPropStorage descendant used to save or restore properties values using an XML file. It introduces new properties, methods, and members needed to read or write values in an XML file.

Values read or written using the class are defined in the SessionProperties for a TForm or TFrame instance. At design-time, use the SessionProperties property editor in the Object Inspector to maintain the property names. At run-time, the property names can be assigned using a string like:

Form1.SessionProperties := 'Width;Height;Image1.Width';

Use the FileName property to specify where the XML content is stored.

Use the RootNodePath property to specify the path to a node in the XML document where the XML content is stored.

At run-time, default handler routines (attached to the parent form) are used to Save or Restore the content in the XML file.

Use the StoredValues property to specify property names which cannot be assigned to the form session properties using the Object Inspector. It can be used for properties which cannot be represented as a singular value or do not have published visibility. Use the OnSavingProperties and OnRestoreProperties event handlers to store or restore (respectively) the values for these items in StoredValues.

TXMLPropStorage can alo be used to save and restore properties for TFrame instances on a form, but it requires some additional coding. The RootNodePath must be specified to identify the path where the TFrame values are stored. In addition, the SessionProperties for the frame must be assigned in an overridden constructor and the Restore method must be called to reload the values. The Save method method also be called in na overridden Destructor for the frame.

A demonstration program is located in the examples directory at:

$(LazarusDir)/examples/propstorage

A tutorial for TXMLPropStorage is located on the Lazarus Wiki at:

https://wiki.lazarus.freepascal.org/TXMLPropStorage

Use TINIPropStorage or TJsonPropStorage components to save and restore session properties using either a .INI file or a JSON (JavaScript Object Notation) file.

See also

TCustomXMLPropStorage

  

Implements the base class for XML storage of Form Session properties.

TForm.SessionProperties

  

Delimited list of form and / or component properties saved to and restored from an external storage mechanism.

TINIPropStorage

  

Implements a class used to store session properties in an INI file.

TJSONPropStorage

  

Implements the final class for the JSON Form Session Properties storage.


Version 3.2 Generated 2024-02-25 Home