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

    Restores previously saved Tree List state information from an INI file.

    Declaration

    procedure RestoreFromIniFile(const AStorageName: string; AChildrenCreating: Boolean = False; AChildrenDeleting: Boolean = False; const ARestoreTreeListName: string = ''; AOptions: TcxTreeListStorageOptions = []);

    Parameters

    Name Type Description
    AStorageName string

    The path to the source INI file.

    AChildrenCreating Boolean

    Optional. Specifies if the procedure creates missing Tree List structure elements (bands and columns):

    False
    Default. The procedure does not create any elements if the current structure contains fewer elements compared to the loaded structure state.
    True

    The procedure creates additional elements to match the loaded structure state.

    Tip

    You can handle the OnInitStoredObject event to initialize created columns.

    If the current Tree List element structure matches the loaded state, the AChildrenCreating parameter is ignored.

    AChildrenDeleting Boolean

    Optional. Specifies if the procedure deletes redundant Tree List structure elements (bands and columns):

    False
    Default. The procedure does not delete any elements if the current structure contains more elements than the loaded structure state.
    True
    The procedure deletes all elements that do not correspond to the loaded structure state.

    If the current Tree List element structure matches the loaded state, the AChildrenDeleting parameter is ignored.

    ARestoreTreeListName string

    Optional. Specifies the restored Tree List name.

    This parameter allows you to apply a saved Tree List state to a different Tree List control. If the number of columns in the target control does not match the loaded structure, the RestoreFromStream procedure creates missing or deletes redundant elements if AChildrenCreating and AChildrenDeleting parameter values are True.

    AOptions TcxTreeListStorageOptions

    Optional. Specifies a set of individual user interaction states restored from the source INI file (AStorageName).

    If this parameter is omitted, the procedure loads only Tree List structure information, even if the source INI file contains user interaction state information.

    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 Tree List state from the INI file.

    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. You can use optional AChildrenCreating and AChildrenDeleting parameters to update the current Tree List element structure according to the loaded state.

    Important

    After each StoreToIniFile procedure call, make sure that the Tree List control maps to the same underlying dataset fields before the corresponding RestoreFromIniFile 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 StoreToIniFile and RestoreFromIniFile 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/restore the focus position.
    tsoSelected
    Stores/restores selection.
    tsoTopRecord
    Stores/restores the Tree List scroll position (the record at the top control border).
    tsoExpanded
    Stores/restores 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 the system registry. The TcxCustomTreeList class implements the following Store~/Restore~ method pairs in addition to StoreToIniFile and RestoreFromIniFile:

    StoreToRegistry | RestoreFromRegistry
    Allow you to store the Tree List state (both data layout and user interaction states) in the system registry.
    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