From RAD Studio API Documentation
Jump to: navigation, search


property Selected: TTreeNode read GetSelected write SetSelected;


__property TTreeNode* Selected = {read=GetSelected, write=SetSelected};


Type Visibility Source Unit Parent
property public
Vcl.ComCtrls TCustomTreeView


Specifies the selected node in the tree view.

Read Selected to access the selected node of the tree view. If there is no selected node, the value of Selected is nil (Delphi) or NULL (C++).

Set Selected to set a node in the tree view. When a node becomes selected, the tree view's OnChanging and OnChange events occur. Also, if the specified node is the child of a collapsed parent item, the parent's list of child items is expanded to reveal the specified node. In this case, the tree view's OnExpanded and OnExpanding events occur as well.

If the RightClickSelect property is true, the value of Selected is the last node that was clicked in the tree view, even if it was clicked with the right mouse button. This may differ from the node that is highlighted to indicate selection.

If the MultiSelect property is true and the MultiSelectStyle property includes msControlSelect, then Selected returns the last node clicked on, even if that click deselected the node. For a current selection status when MultiSelect is true, refer to the Selections property.

See Also

Code Examples