LabVIEW以编程方式对Cluster移动隐藏重命名标题和大小
可移动Cluster控件VI,能够在运行时使用右键单击上下文菜单,隐藏或移动Custer中的控件。如果应用程序发运给多个客户,则此功能非常有用,每个客户都希望自定义配置和大型Custer中字段的标题。运行随附的VI,了解如何在应用程序中实现此功能。
此VI的灵感来自本网站上的其他几个示例,这些示例处理以编程方式移动FP控件并使用动态快捷菜单创建以及事件处理。
移动
右键单击每个控件,然后选择“移动”。这将触发一个事件,该事件将控件移动到Custer中的任意位置。不能将控件拖到群集外部。
隐藏
右键单击每个控件,然后选择 “隐藏”.这将触发更改控件可见性的事件。
重置为默认值
单击此按钮使用第二个隐藏控件的位置属性来重置在执行过程中移动的控件的位置。它还会导致所有隐藏控件的可见性恢复为可见。
重命名字幕
重命名标题按钮循环遍历每个控件,并将“Caption.text”属性替换为用户输入的“值”。适用于多语言应用程序。
大小为文本
此按钮根据输入的文本调整 String 控件的垂直高度。Custer中的所有字段默认为单行。如果想查看3 行地址字段,只需输入想要出现的地址,然后点击按钮。垂直高度使用“大小到文本”属性进行调整。
ProgrammaticallyMove/Hide, Rename Captions, and Size To Text Controls in Cluster
The Moveable Cluster Controls VI enables youto use a right click context menu to hide or move the controls in a clusterduring run-time. This functionality is useful if your application ships tomultiple customers each of whom want custom configurations and captions of thefields in a large cluster. Run theincluded VI to see how you can implement this functionality in yourapplications.
This VIwas inspired by several other examples on this site that deal withprogrammatically moving FP controls and uses dynamic shortcut menu creation, aswell as event handling.
Move
RightClick each control and select "Move". This triggers an event that moves the control wherever your mouse moveswithin the cluster. You can't drag thecontrol outside of the cluster.
Hide
RightClick each control and select "Hide" . This triggers an event that changes thevisibility of the control.
Reset ToDefault
Clickingthis button uses the position properties of a second hidden control to resetthe positions of the controls that have been moved during execution. It also causes the visibility to go back tovisible for all hidden controls.
RenameCaptions
The renamecaptions button loops over each control and replaces the"Caption.text" property with "Value" entered by theuser. Good for multilingual apps.
Size ToText
Thisbutton resizes the vertical height of the String controls based on the textentered. All of the fields in thecluster default to single line. If youwant to see a 3 line address field, just type in the address as you want it toappear, and hit the button. The verticalheight is adjusted using the "Size to Text" property.
需要说明的是,上述的例程和文档,都是可以下载的,双击即可打开,其中压缩文件是可以采用粘贴复制的方式,拷贝到硬盘上。这不是图片,各位小伙伴看到后尝试一下,这个问题就不用加微信咨询了。有关LabVIEW编程、LabVIEW开发等相关项目,可联系们。附件中的资料这里无法上传,可去公司网站搜索下载。