[Overview][Constants][Types][Classes][Procedures and functions][Index] | Reference for unit 'ComCtrls' (#lcl)

# TCustomTreeView.ApplyStoredSelection

Selects the tree node with the access path represented in the specified string list.

## Declaration

Source position: comctrls.pp line 3746

`public procedure TCustomTreeView.ApplyStoredSelection(`
`ASelection: TStringList;`
`FreeList: Boolean = True`
`);`

## Arguments

`ASelection` |  | TStringList with the text for nodes used to access the selected tree node.
`FreeList` |  | True if the TStringList instance is freed in the method.

## Description

ApplyStoredSelection is used to locate a tree node in Items which matches the specified access path. ASelection contains values, as returned by StoreCurrentSelection, where each line is the text for a tree node in the path to the selected node.

ApplyStoredSelection searches the sibling and child nodes in Items to locate a tree node which matches the specified values. When a node is found, Selected is set to the TTreeNode instance located in the method. If a node is not found, Selected is set to Nil.

ApplyStoredSelection causes the OnSelectionChanged event handler to be signalled (when assigned) when the value in Selected is updated.

FreeList indicates whether ASelection is freed in the method. When set to False, the TStringList instance must be freed in the caller or a memory leak can occur.

## See also

TCustomTreeView.Selected |  | The selected tree node in the control.
TCustomTreeView.Items |  | The container with the TTreeNode instances for the control.
TCustomTreeView.StoreCurrentSelection |  | Creates and fills a TStringList with the text for each of the tree nodes in the access path to the Selected node on the tree view control.
TCustomTreeView.OnSelectionChanged |  | Event handler signalled when the selection in the tree view control is changed.
TTreeNode.Text |  | Text displayed for the tree node.
TTreeNode.GetFirstChild |  | Gets the first child node in the Items property.
TTreeNode.GetNextSibling |  | Returns the next node in the tree hierarchy at the same level as the current node.
TTreeNodes.GetFirstNode |  | Gets the first tree node in the container.