Skip to main content
All docs
V25.1
  • TcxCustomTreeList.StoreToRegistry(string,Boolean,string,TcxTreeListStorageOptions) Method

    Saves Tree List state information to the system registry.

    Declaration

    procedure StoreToRegistry(AStorageName: string; AReCreate: Boolean = True; const ASaveTreeListName: string = ''; AOptions: TcxTreeListStorageOptions = []);

    Parameters

    Name Type Description
    AStorageName string

    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 path.
    False
    The procedure adds saved information to the target registry key if it exists.
    ASaveTreeListName string

    Optional. Specifies the saved Tree List name.

    Use this parameter if you need to apply a saved state to a different Tree List control.

    AOptions TcxTreeListStorageOptions

    Optional. Specifies a set of individual user interaction states saved to the target system registry key (AStorageName).

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

    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 Tree List state from the system registry key.

    Stored Information

    Tree List Structure | Data Layout

    Tree List structure information includes the following:

    • Tree List name.
    • All Tree List element settings available to end users for customization: position, dimensions, visibility, sort order, captions, etc.

    Important

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

    Tree List User Interaction States (Optional)

    In addition to the base Tree List Structure/Data Layout, the AOptions parameter available for StoreToRegistry and RestoreFromRegistry procedures allows you to store a number of user interaction states (selection, focus, scroll position, node expanded status, etc.)

    Pass a set of all required flags as the AOptions parameter to store/restore corresponding Tree List user interaction states:

    tsoUseDataViewState

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

    Tip

    Alternatively, you can use only the cxTreeListStoreAllDataViewStates constant if you need to store all user interaction states for the Tree List.

    tsoFocusedItem | tsoFocusedRecord
    Store the focus position.
    tsoSelected
    Stores selection.
    tsoTopRecord
    Stores the Tree List scroll position (the record at the top control border).
    tsoExpanded
    Stores the expanded status for all nodes.

    Other Tree List Store/Restore Methods

    Alternatively, you can store Tree List data layout and user interaction states in memory, a stream, or an INI file. The TcxCustomTreeList class implements the following Store~/Restore~ method pairs in addition to StoreToRegistry and RestoreFromRegistry:

    StoreToIniFile | RestoreFromIniFile
    Allow you to store the Tree List state (both data layout and user interaction states) in an INI file.
    StoreToStream | RestoreFromStream
    Allow you to store the Tree List 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.
    See Also