zl程序教程

您现在的位置是:首页 >  后端

当前栏目

LabVIEW实现编程改变EnumeratedType说明与例程

编程 实现 说明 改变 例程 labview
2023-09-14 09:09:44 时间

LabVIEW实现编程改变EnumeratedType说明与例程

Enum 只能在编辑模式下更改。如果您尝试在运行时更改它,您将获得错误。

无法在运行时间编辑 Enum。另一种选择是使用 VI 服务器:您可以参考如下的例程,程序将元素添加到 Enum / Ring中。

 

另一种选择是使用文本环控制。您可以使用环控制程序化地读取和写入字符串属性。。如下图所示。

在运行时间中,您无法从编程方式更改列举的数据类型(字符串),就像您无法从编程方式将整数控制更改为双控件或字符串控制以转换为路径控制一样。

You cannot programmatically change the type (the strings) of an enumerated data type in runtime, just as you cannot programmatically change an integer control into a double or a string control into a path control.

The strings in an Enum are a part of its data type and thus can only be changed during edit time. It is possible to read the strings of the Enum through a Property Node, but you cannot write them using a Property Node.

Note: If you have a large array of strings that you would like to populate an Enum with, you can simply replace the Enum with a text ring by right clicking on the Enum and selecting Replace and selecting the text ring. Create a property node to write to Strings and then run your program to write the string array to the property node. This will populate the text ring. Once the text ring is populated, you can "Replace" it with an Enum and it will retain all of the values from the text ring.

可以通过修改Enum的内容,但是不能实时更新,适合编程写入很多Item的场合使用。

源程序如下所示。

在LabVIEW中,运行VI时你不能改变专有标签的值. 专有标签是输入控件或显示控件所拥有的标签,也是属性节点的标签项。这些项只有在程序开发的时候可以被改变,这是因为它是用来在VI运行时辨别VI输入控件和显示控件的。当通过属性节点试图改变标签时会产生错误代码1073。

一种更改输入控/输出控件的“标签”的简单方法是使用标题来标识显示控件/输入控件而不是通过专有标签。你可以在程序执行或开发时改变标题。如果要使用标题而不是标签作为标识符,我们可以使用三个属性节点使来让标题设为可见,标签设为隐藏,或更改标题的文本。用于执行此操作的三种属性节点分别为: 标题可见,标签可见和标题文本 。

当VI未运行时,可以以编程方式从另一个VI写入标签文本。有关此示例请参阅:Change Label Text of Control in Another VI(如何从另一个VI中更改控件的标签文本)。

LabVIEW、LabVIEW开发、LabVIEW编程、LabVIEW程序
文字内容均在附件Word中,同时上文中提到的例子和资料,均在word中的附件里,可点击下载。登录www.bjcyck.com可以查看更多详细信息。这里只是简略的介绍,有任何关于LabVIEW、LabVIEW开发、LabVIEW编程、LabVIEW程序相关问题,请与我们联系。
链接地址为:LabVIEW实现编程改变EnumeratedType说明与例程 - 北京瀚文网星科技有限公司 (bjcyck.com)