LabVIEW文件和文件夹资源管理器Tree Control
本示例是一个文件管理器窗口,包括LabVIEW树控制中的默认文件图标。与递归文件列表VI不同,无论字母顺序如何,这都会在文件之前显示子目录。对于非LabVIEW文件扩展名,将返回系统图标。这意味着开发人员无需为不同的文件扩展名维护自己的自定义符号。
代码:
以下VI替换递归文件列表VI,因此目录在文件之前排序。文件和文件夹作为层次结构路径数组返回。文件夹索引允许开发人员按文件夹或文件类型进行筛选。
显示:
列出内容很容易,下一步是创建一个具有专业外观的显示器来查看文件。此VI采用路径层次结构并将其转换为树项目。此外,为每个文件扩展名缓存字形,以设置树的自定义符号数组,从而使树具有专业的外观。
应用:
查看示例VI以了解其工作原理。运行时也支持此功能,这意味着开发人员可以构建自己的文件资源管理器并根据需要自定义树。
文件:
ExplorerTreeExample.vi -顶级VI
ExplorerTreeRecursive Files.vi-目录和按字母顺序排序的递归文件列表
ExplorerTree RecursiveFiles Tree.vi-树控制项和字形的文件夹内容
Tree Control File and Folder Explorer with System Icons
Summary:
Thisexample replicates a file explorer window including the default file icons in aLabVIEW Tree Control. Unlike the Recursive File List VI, this displays thesub-directories before the files regardless of alphabetical order. Fornon-LabVIEW file extensions, the system shell icons are returned. This meansyou won't need to maintain your own custom symbols for different fileextensions.
TheCode:
Thefollow VI replaces the Recursive File List VI so the directories are sortedbefore the files. The files and folders are returned as a hierarchy path array.The folder indexes allow the developer to filter by folder or file type.
ExplorerTreeRecursive Files.png
TheDisplay:
Listingcontent is easy, the next step is creating a professional looking display toview the files, no problem... This VI takes the path heirarchy and convertsthem to Tree items. In addition, glyphs are cached for each file extension toset the tree's custom symbols array which gives your tree that professionallook.
ExplorerTreeRecursive Files Tree.png
TheApplication:
Checkout the example VI to see how this works. This is also supported at Run-Timewhich means you can build your own file explorer and customize the tree as yousee fit.
需要说明的是,上述的例程和文档,都是可以下载的,双击即可打开,其中压缩文件是可以采用粘贴复制的方式,拷贝到硬盘上。这不是图片,各位小伙伴看到后尝试一下,这个问题就不用加微信咨询了。有关LabVIEW编程、LabVIEW开发等相关项目,可联系们。附件中的资料这里无法上传,可去公司网站搜索下载。
LabVIEW程序,如下附件所示。
如看附件,请点击链接