vcl-cxgridcustomview-dot-tcxcustomgridview-dot-restorefromregistry-x28-system-dot-string-system-dot-boolean-system-dot-boolean-cxgridcustomview-dot-tcxgridstorageoptions-system-dot-string-system-dot-string-x29.md
Restores previously saved grid View state information from the system registry.
procedure RestoreFromRegistry(const AStorageName: string; AChildrenCreating: Boolean = True; AChildrenDeleting: Boolean = False; AOptions: TcxGridStorageOptions = [gsoUseFilter, gsoUseSummary]; const ARestoreViewName: string = ''; const AOwnerName: string = '');
| Name | Type | Description |
|---|---|---|
| AStorageName | string |
The source registry key.
The root system registry key for AStorageName is HKEY_CURRENT_USER.
| | AChildrenCreating | Boolean |
Optional. Specifies if the procedure creates missing grid View structure elements (columns, bands, series, etc.):
True
Default. The procedure creates additional elements to match the loaded structure state.
Tip
You can handle the OnInitStoredObject event to initialize created grid data items.
FalseThe procedure does not create any elements if the current structure contains fewer elements compared to the loaded structure state.
If the current grid View structure matches the loaded state, the AChildrenCreating parameter is ignored.
| | AChildrenDeleting | Boolean |
Optional. Specifies if the procedure deletes redundant grid View structure elements (columns, bands, series, etc.):
False Default. The procedure does not delete any elements if the current structure contains more elements than the loaded structure state.TrueThe procedure deletes all elements that do not correspond to the loaded structure state.
If the current grid View structure matches the loaded state, the AChildrenDeleting parameter is ignored.
| | AOptions | TcxGridStorageOptions |
Optional. Specifies a set of individual user interaction states restored from the source registry key (AStorageName).
If this parameter is omitted, the procedure loads only the grid View structure information, even if the source registry key contains user interaction state information.
| | ARestoreViewName | string |
Optional. Specifies the source 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.
|
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.
Grid View structure information includes the following:
AChildrenCreating and AChildrenDeleting parameters to update the current grid View data layout according to the loaded state.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.
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/restore the focus position. Require gsoUseDataViewState.gsoSelectedStores/restores selection. Requires gsoUseDataViewState.gsoTopRecordStores/restores the grid View scroll position. Requires gsoUseDataViewState.gsoExpandedStores/restores the expanded status for all records. Requires gsoUseDataViewState.gsoDetailStores/restores the active detail grid View. Applicable only to master-detail grid View relationships. Requires gsoUseDataViewState.
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