Back to Devexpress

Storing And Restoring The ExpressVerticalGrid Layout

vcl-167023-expressverticalgrid-concepts-storing-and-restoring-the-expressverticalgrid-layout.md

latest3.4 KB
Original Source

Storing And Restoring The ExpressVerticalGrid Layout

  • Jul 29, 2021
  • 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:

MethodDescription
StoreToIniFileStores the vertical grid layout to an INI-file.
RestoreFromIniFileRestores the vertical grid layout from an INI-file.
StoreToRegistryStores the vertical grid layout to a registry key.
RestoreFromRegistryRestores the vertical grid layout from a registry key.
StoreToStreamStores the vertical grid layout to a stream.
RestoreFromStreamRestores 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:

delphi
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.
delphi
cxDBVerticalgrid.StoreToRegistry('VGrid\StoreTest');

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

Note

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