Back to Devexpress

TcxCustomGridView.StoreToRegistry(string,Boolean,TcxGridStorageOptions,string,string) Method

vcl-cxgridcustomview-dot-tcxcustomgridview-dot-storetoregistry-x28-system-dot-string-system-dot-boolean-cxgridcustomview-dot-tcxgridstorageoptions-system-dot-string-system-dot-string-x29.md

latest8.3 KB
Original Source

TcxCustomGridView.StoreToRegistry(string,Boolean,TcxGridStorageOptions,string,string) Method

Saves specified View data structure and user interaction information to the system registry.

Declaration

delphi
procedure StoreToRegistry(const AStorageName: string; AReCreate: Boolean = True; AOptions: TcxGridStorageOptions = []; const ASaveViewName: string = ''; const AOwnerName: string = '');

Parameters

NameTypeDescription
AStorageNamestring

The target registry key.

The root system registry key for AStorageName is HKEY_CURRENT_USER.

| | AReCreate | Boolean |

Optional. Specifies if the procedure recreates the target system registry key if it exists.

True Default. The procedure deletes the target registry key (AStorageName) if it exists and creates a new registry key with the same name.FalseThe procedure adds saved information to the end of the target registry key if it exists. | | AOptions | TcxGridStorageOptions |

Optional. A set of flags that correspond to individual settings and states saved to the target stream (AStream).

If this parameter is omitted, the procedure saves only view structure information.

| | ASaveViewName | string |

Optional. Specifies the saved grid View name.

Use this parameter if you need to apply a saved state to a different grid View.

| | AOwnerName | string |

Optional. Specifies the parent form name for the TcxGrid control.

Tip

This parameter can be useful for MDI application projects.

|

Remarks

Call the StoreToRegistry procedure to save the current data layout and specified user interaction states to a system registry key. A subsequent RestoreFromRegistry call restores the saved grid View state from the system registry key.

Stored Information

View Structure | Data Layout

Grid View structure information includes the following:

  • Grid View type and name.
  • All grid View element settings available to end users for customization: position, dimensions, visibility, sort order, etc.

Important

After each StoreToRegistry procedure call, make sure that the grid View maps to the same underlying dataset fields before the corresponding RestoreFromRegistry call. Otherwise, errors may occur.

View and User Interaction States (Optional)

In addition to the base View Structure/Data Layout, the AOptions parameter available for StoreToRegistry and RestoreFromRegistry procedures allows you to store summaries, filter criteria, and a number of user interaction states (selection, focus, the scroll position, etc.).

Pass a set of all required flags as the AOptions parameter to store/restore corresponding grid View states:

gsoUseFilter | gsoUseSummaryAllow you to store filter criteria and summaries.gsoUseDataViewState

The main flag required for all other user interaction flags listed below. These flags have no effect without gsoUseDataViewState.

Tip

Alternatively, you can use only the cxGridStoreAllDataViewStates constant if you need to store all user interaction states for the grid View.

gsoFocusedItem | gsoFocusedRecord | gsoFocusedViewStore the focus position. Require gsoUseDataViewState.gsoSelectedStores selection. Requires gsoUseDataViewState.gsoTopRecordStores the grid View scroll position. Requires gsoUseDataViewState.gsoExpandedStores the expanded status for all records. Requires gsoUseDataViewState.gsoDetailStores the active detail grid View. Applicable only to master-detail grid View relationships. Requires gsoUseDataViewState.

Other View State Store/Restore Methods

Alternatively, you can store grid View data layout and user interaction states in an INI file, stream, or custom storage. The TcxCustomGridView class implements the following Store~/Restore~ method pairs in addition to StoreToRegistry and RestoreFromRegistry:

StoreToIniFile | RestoreFromIniFileAllow you to store the grid View state (both data layout and user interaction states) in an INI file.StoreToStorage | RestoreFromStorageAllow you to store the grid View state (both data layout and user interaction states) in a custom data format.StoreToStream | RestoreFromStreamAllow you to store the grid View state (both data layout and user interaction states) in a stream.StoreDataViewState | RestoreDataViewStateAllow you to store user interaction states in memory during the same session.StoreDataViewStateToStream | RestoreDataViewStateFromStreamAllow you to store only user interaction states in a separate stream. See Also

TcxCustomTreeList.StoreToRegistry Procedure

TcxCustomGridView Class

TcxCustomGridView Members

cxGridCustomView Unit