Delphi 非可视化 TTree 实现 [英] Delphi non visual TTree implementation

查看:17
本文介绍了Delphi 非可视化 TTree 实现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种非可视化持久树 (TStringTree) 实现.如果有人知道它有什么好的实现,请告诉我.

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

谢谢.

推荐答案

您会在 DI 容器 库(商业).然而,正如上面其他人所指出的,推出自己的产品真的很容易,只添加您需要的功能.

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.

您可以只使用两个基本对象:TNode 和 TNodeList(例如 TObjectList 后代).至少,TNode 只需要三个成员:您的字符串数据、对其父节点的引用(如果节点是根节点则为 nil)和一个 TNodeList,它是其子节点的列表.剩下的是各种附带方法的(有点乏味)实现,例如 Add()、Delete()、IndexOf()、MoveTo()、GetFirstChild()、GetNext() 等. 基本树应该小于一-过夜.

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.

这篇关于Delphi 非可视化 TTree 实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆