使用目录树和过滤填充 TTreeView
在 Lazarus 0.9.28.2 项目中,我的 Form(frmConvert
) 上有一个 TTreeView
,其名称为 DirTree
,但我想填充它包含从 C:\
开始的所有目录树。
像这样:
C:\ 目录树 http://i.imagehost.org/0185/cdirtree.png
当用户选择目录时,在第二个名为 FileTree
的 TTreeView
中,会显示该目录中的所有文件,但经过过滤后仅显示 PDF。
我还需要帮助来放置这些图标,因为对于最终用户来说更有组织性和友好性非常好。
问题
- 如何使用所有目录填充第一个 TTreeView(
DirTree
),如图所示? - 如何使用
DirTree
上所选目录中的文件填充第二个 TTreeview(FileTree
)? - 如何为
DirTree
上的每个文件夹(仅限文件夹)设置图标?
On a Lazarus 0.9.28.2 project I have a TTreeView
, with the name DirTree
on my Form(frmConvert
), but I want to populate it with all the directory tree, since C:\
.
Like this:
C:\ Directory Tree http://i.imagehost.org/0185/cdirtree.png
And when the user select the directory, in the second TTreeView
, with the name FileTree
, appear all the files in that directory, but filtered to show only PDFs.
Also I want help to put these icons, because is very nice to be more organized and friendly for the end-user.
Questions
- How can I populate the first TTreeView(
DirTree
) with all the directorys, like in the image? - How can I populate the second TTreeview(
FileTree
) with the files on the directory selected onDirTree
? - How can I set a icon for each folder(only folders) on
DirTree
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
填充 dirTree 的代码(修订版)
****填充 FileTree 的代码(修订版)****
添加到表单的附加过程
您需要添加图像列表到您的表单中,添加一个文件夹图标(borland 公共文件中有一个),然后将图像列表与目录树视图和文件树树视图关联
如何调用 FILTEREDTV 的示例步骤
将以下代码附加到目录树的OnClick事件中
Code to populate the dirTree (REVISED)
****Code to populate FileTree (REVISED) ****
Additional procedure to add to form
You need to add an image list to your form, add a folder icon to it (there is one in the borland common files) and then associated the image list with the directory treeview and the filetree treeview
EXAMPLE OF HOW TO CALLED FILTEREDTV procedure
Attach the following code to the OnClick event of the directory tree