Tree Views

From RAD Studio
Jump to: navigation, search

Go Up to List Controls

A tree view (TTreeView) displays items in an indented outline. The control provides buttons that allow nodes to be expanded and collapsed. You can include icons with items' text labels and display different icons to indicate whether a node is expanded or collapsed. You can also include graphics, such as check boxes, that reflect state information about the items.

  • Indent sets the number of pixels horizontally separating items from their parents.
  • ShowButtons enables the display of "+" and "-" buttons to indicate whether an item can be expanded.
  • ShowLines enables display of connecting lines to show hierarchical relationships.
  • ShowRoot determines whether lines connecting the top-level items are displayed.

To add items to a tree view control at design time, double-click on the control to display the TreeView Items editor. The items you add become the value of the Items property. You can change the items at run time by using the methods of the Items property, which is an object of type TTreeNodes. TTreeNodes has methods for adding, deleting, and navigating the items in the tree view.

Tree views can display columns and subitems similar to list views in vsReport mode.

See Also