TcxCustomGridView.StoreToIniFile(string,Boolean,TcxGridStorageOptions,string,string) Method
Saves grid View state information to an INI file.
Declaration
procedure StoreToIniFile(const AStorageName: string; AReCreate: Boolean = True; AOptions: TcxGridStorageOptions = []; const ASaveViewName: string = ''; const AOwnerName: string = '');
Parameters
Name | Type | Description |
---|---|---|
AStorageName | string | The path to the target INI file. |
AReCreate | Boolean | Optional. Specifies if the procedure recreates the target INI file if it exists.
|
AOptions | TcxGridStorageOptions | Optional. Specifies a set of individual user interaction states saved to the target INI file ( If this parameter is omitted, the procedure saves only grid 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 StoreToIniFile
procedure to save the current data layout and specified user interaction states to an INI file. A subsequent RestoreFromIniFile call restores the saved grid View state from the INI file.
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 StoreToIniFile
procedure call, make sure that the grid View maps to the same underlying dataset fields before the corresponding RestoreFromIniFile 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 StoreToIniFile
and RestoreFromIniFile 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 | gsoUseSummary
- Allow 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 | gsoFocusedView
- Store the focus position. Require gsoUseDataViewState.
- gsoSelected
- Stores selection. Requires gsoUseDataViewState.
- gsoTopRecord
- Stores the grid View scroll position. Requires gsoUseDataViewState.
- gsoExpanded
- Stores the expanded status for all records. Requires gsoUseDataViewState.
- gsoDetail
- Stores 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 a stream, system registry, or custom storage. The TcxCustomGridView class implements the following Store~
/Restore~
method pairs in addition to StoreToIniFile
and RestoreFromIniFile:
- StoreToRegistry | RestoreFromRegistry
- Allow you to store the grid View state (both data layout and user interaction states) in the system registry.
- StoreToStorage | RestoreFromStorage
- Allow you to store the grid View state (both data layout and user interaction states) in a custom data format.
- StoreToStream | RestoreFromStream
- Allow you to store the grid View state (both data layout and user interaction states) in a stream.
- StoreDataViewState | RestoreDataViewState
- Allow you to store user interaction states in memory during the same session.
- StoreDataViewStateToStream | RestoreDataViewStateFromStream
- Allow you to store only user interaction states in a separate stream.