Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delphi non visual TTree implementation

Tags:

tree

delphi

vcl

I'm looking for a non visual persistent tree (TStringTree) implementation. If someone known any good implentation of it, please let me know.

Thanks.

like image 280
Francis Lee Avatar asked Dec 18 '22 04:12

Francis Lee


1 Answers

You'll find a flexible, non-visual tree structure in the DI Containers library (commercial). However, as others have noted above, it's really quite easy to roll your own, adding only the functionality that you need.

You can do with just two base objects: TNode and a TNodeList (e.g. a TObjectList descendant). At minimum, TNode needs just three members: your string data, a reference to its parent node (nil if the node is root), and a TNodeList, which is a list of its child nodes. What remains is the (somewhat tedious) implementation of the various attendant methods such as Add(), Delete(), IndexOf(), MoveTo(), GetFirstChild(), GetNext() etc. The basic tree should be less than a one-nighter.

like image 89
Marek Jedliński Avatar answered Dec 28 '22 22:12

Marek Jedliński