TTreeView

From Free Pascal wiki
Revision as of 15:33, 10 December 2008 by Sekelsenmat (talk | contribs) (New page: ==Adding a new item in code== Use TTreeView.Items.AddChild or AddChildObject. ==Creating a TreeView which loads items only when expansing== To add the expansion symbol to a node witho...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Adding a new item in code

Use TTreeView.Items.AddChild or AddChildObject.


Creating a TreeView which loads items only when expansing

To add the expansion symbol to a node without subitems use:

MyNode.HasChildren := True;

And then set an event handler for the OnExpanding event. In this even you should return if the expansion can actually be made or not and when yes, you should add subitems to the node. If the expansion cannot be done, the expansion symbol will be automatically removed even if you have previously set HasChildren to true.