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

# 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.

## Declaration

Source position: comctrls.pp line 3744

`public function TCustomTreeView.StoreCurrentSelection: TStringList;`

## Function result

TStringList instance with the text for the nodes in the path to the selected node on the control.

## Description

StoreCurrentSelection uses the Selected property to determine the values returned in the TStringList instance. The Text for each of the TTreeNode instances is inserted in the return value in the order the nodes were visited to reach the Selected node. The Text for each of the tree nodes appears on a separate line.

If multi-selection is enabled on the tree view control, the first node in Selections is used in the method (same value as Selected).

It is the responsibility of the calling routine to free the TStringList instance in the return value. Failure to do so will result in a memory leak.

## See also

TCustomTreeView.Selected |  | The selected tree node in the control.
TTreeNode.Parent |  | Parent node for the current tree node.
TTreeNode.Text |  | Text displayed for the tree node.