Delphi comes with the TTreeView control - located on the "Win32" section of the tool palette. Defined in the ComCtrls unit, the TTreeView does a decent task of allowing you to present any parent-child relation of any type of objects.
Each node in the TTreeView consists of a label and an optional bitmapped image - and the TTreeNode object describes an individual node in a TTreeView control.
While powerful enough for most of the tasks if your application is based on displaying hierarchical data, like folders and files, XML structure, any anything alike, you would soon realize that you need more power from a tree view like component.
This is where one gem of the 3rd party components world comes to the rescue: the Virtual TreeView component.
Virtual TreeViewThe Virtual TreeView, initially being developed by Mike Lischke and now being maintained as an open source project on Google Code is a must-use control if you are up to working with whatever you could call "nodes".
With more than 13 years spend in development, the Virtual TreeView is one of the most polished, flexible and advanced open source components for the Delphi market.
Never mind the Delphi version you are using from Delphi 7 to the latest version (XE3 at the moment) you would be able to use and leverage the power of the TVirtualStringTree and TVirtualDrawTree (the actual names of the controls) in your applications.
Here are just a few "why to use" features of the Virtual TreeView control:
- very small memory foot print.
- super fast.
- virtual - meaning it does not know about the data it manages - only the size. Everything is done via events.
- supports multi-column views
- easy customization of a node display with bitmaps and font styles.
- drag'n drop and clipboard support
- each node in the tree can have its own check type (even mixed tri-state partial checking).
- sophisticated tree content serialization.
- edit tree data using application defined editors.
For the start, let's see how to install the Virtual TreeView in Delphi's IDE.