Skip to main content

TcxCustomPropertiesStore Class

The base class for the TcxPropertiesStore component.

Declaration

TcxCustomPropertiesStore = class(
    TcxCustomComponent
)

Remarks

This class defines the essential functionality for the TcxPropertiesStore component. It provides an API that allows you to persist the published properties of any components residing on the same form as a TcxPropertiesStore component in a specific storage (the registry, an INI file, or stream).

If the property selected for saving/restoring represents a TPersistent descendant, all its sub-properties can be stored/restored. For instance, if you specify the control’s Font property to store, all its published sub-properties (Charset, Color, Height, Name, Pitch, Size and Style) will be saved as well. You can insert the “Font.Style“ string into the component’s Properties list instead of “Font“ to save only the Style property of the TFont object associated with the Font property.

The TcxPropertiesStore component enables you to save/restore properties of TCollection elements. For instance, this can be used to save summary items (TcxDataSummary.FooterSummaryItems, TcxDataSummary.DefaultGroupSummaryItems, TcxDataSummary.SummaryGroups), bands in a grid control (TcxGridBandedTableView.Bands), etc. At design time, the TcxPropertiesStore only allows you to select entire collections for storing/restoring. Using code though, allows saving individual items from collections, as well as the properties of a particular collection item. When restoring elements from storage, the collection must contain the same number of items as in the storage.

The TcxPropertiesStore component does not allow you to store/restore sub-properties of the properties derived from the TComponent class. When a property references a TComponent descendant, only the object’s Name is saved.

To select components to store/restore using the TcxPropertiesStore object, you should add items to its Components collection. Every element in the collection represents a TcxPropertiesStoreComponent instance referring to the component and its properties. The component and its properties are specified by the TcxPropertiesStoreComponent.Component and TcxPropertiesStoreComponent.Properties attributes respectively. If you do not specify any properties via the TcxPropertiesStoreComponent.Properties list, no properties will be stored to/restored from the storage.

The TcxPropertiesStore component automatically restores properties of selected components when the form owning the component is created. On destroying the form, the TcxPropertiesStore automatically overwrites (or creates) the storage and saves the properties of selected components. This default behavior may be disabled by setting the Active property to False. In this case, the selected components’ settings can still be saved/restored by calling the StoreTo/RestoreFrom methods manually.

The storage used for saving component settings is specified by two properties: StorageType and StorageName.

The StoreTo/RestoreFrom methods allow you to save/restore properties for all selected components. To operate on individual components, you need to call the StoreTo…/RestoreFrom… methods (for instance, StoreToRegistry or RestoreFromStream) of the corresponding TcxPropertiesStoreComponent instances within the Components collection.

Inheritance

See Also