Vcl.ComCtrls.TCustomTreeView.Items

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property Items: TTreeNodes read FTreeNodes write SetTreeNodes;

C++

__property TTreeNodes* Items = {read=FTreeNodes, write=SetTreeNodes};

Properties

Type Visibility Source Unit Parent
property protected
Vcl.ComCtrls.pas
Vcl.ComCtrls.hpp
Vcl.ComCtrls TCustomTreeView

Description

Lists the individual nodes that appear in the tree view control.

Individual nodes in a tree view are TTreeNode objects. These individual nodes can be accessed by using the Items property along with the item's index into the tree view. For example, to access the second item in the tree view, you could use the following code.



MyTreeNode := TreeView1.Items[1];



MyTreeNode = TreeView1->Items[1];



When setting this property at design-time in the Object Inspector the Tree View Items Editor appears. Use the New Item and New SubItem buttons to add items to the tree view. Use the Text property to modify what text is displayed in the label of the item.

At run-time nodes can be added and inserted by using the TTreeNodes methods AddChildFirst, AddChild, AddChildObjectFirst, AddChildObject, AddFirst, Add, AddObjectFirst, AddObject, and Insert.

Note: Accessing tree view items by index can be time-intensive, particularly when the tree view contains many items. For optimal performance, try to design your application so that it has as few dependencies on the tree view's item index as possible.

See Also

Code Examples