Skip to main content

Storing And Restoring The ExpressVerticalGrid Layout

  • 2 minutes to read

The ExpressVerticalGrid control provides a means to save and restore its layout. This functionality is encapsulated in a series of methods:

Method Description
StoreToIniFile Stores the vertical grid layout to an INI-file.
RestoreFromIniFile Restores the vertical grid layout from an INI-file.
StoreToRegistry Stores the vertical grid layout to a registry key.
RestoreFromRegistry Restores the vertical grid layout from a registry key.
StoreToStream Stores the vertical grid layout to a stream.
RestoreFromStream Restores the vertical grid layout from a stream.

The above mentioned methods save and restore the layout information, which includes:

Examples of saving the ExpressVerticalGrid layout are demonstrated below:

cxDBVerticalgrid.StoreToIniFile('c:\storetest.ini');

The storetest.ini file portion is demonstrated below:

[cxDBVerticalGrid: TcxDBVerticalGrid]
=
HeaderWidth=220
ValueWidth=171
[cxDBVerticalGrid/0: TcxCategoryRow]
=
AParentID=-1
Index=0
Visible=True
Height=-1
Expanded=True
[cxDBVerticalGrid/1: TcxDBMultiEditorRow]
=
AParentID=0
Index=0
Visible=True
Height=-1
Expanded=True
[cxDBVerticalGrid/2: TcxDBMultiEditorRow]
=
AParentID=0
Index=1
Visible=True
Height=-1
Expanded=True
[cxDBVerticalGrid/3: TcxCategoryRow]
=
AParentID=-1
Index=1
Visible=True
Height=-1
Expanded=True
  • Using the StoreToRegistry method. Keep in mind, that this method by default stores the layout to the HKEY_CURRENT_USER registry key. The string parameter accepted by this method represents the registry key suffix.
cxDBVerticalgrid.StoreToRegistry('VGrid\StoreTest');

The system registry key which represents the stored layout is demonstrated in the following screenshot:

Layout Stored as a Registry Key

Note

the number of rows within the vertical grid control must remain the same between saving and restoring, otherwise restoring will fail.