Mega Code Archive

 
Categories / Delphi / VCL
 

A Gardeners Guide To The Tree View Part II

Title: A Gardener's Guide To The Tree View: Part II Question: What are the general properties and methods of the TreeView and TreeNode objects, and what effects/purposes do they serve? Answer: This is the second installment in the Gardener's Guide to the TreeView. Advancing on what we learned in Part I, adding items to the TreeView, this new tutorial project presents the user with a form that publishes at runtime a wide variety of navigation and manipulation properties and methods of TTreeView, TTreeNodes and TTreeNode. In detail, the following items are covered: TTreeView Methods AlphaSort FullCollapse FullExpand LoadFromFile SaveToFile Properties AutoExpand HideSelection HotTrack ReadOnly ShowLines ShowRoot TopItem TTreeNodes Methods Add AddFirst AddChild AddChildFirst Properties Count Items TTreeNode Methods AlphaSort Delete DeleteChildren Collapse Expand GetFirstChild GetNextSibling GetNextChild GetNext GetNextVisible Of particular note is the LoadFromFile and SaveToFile functionality of the TTreeView class. A sample TreeView is included in the zip file with an RTV extension. You can play around with creating your own TreeViews and save them for later use. This tutorial has an advantage in that it not only describes in fair detail the purpose of each property and method in code comments, but also provides you with effectively a property editor for the TreeView. Future parts of this tutorial will expand on that concept, and will delve into topics beyond the TreeView, though the core subject matter will remain constant. I hope that these tutorials are of use to readers and programmers. If you have any questions or comments about them, feel free to e-mail me at ghannodahn@icitadel.com. The third part of this tutorial will incorporate a system to load data from a database table and populate the TreeView from it, or write the contents to a table.