当前位置:网站首页>LabVIEW学习笔记九:捕捉由程序修改控件值产生的“值改变”事件
LabVIEW学习笔记九:捕捉由程序修改控件值产生的“值改变”事件
2022-07-27 18:08:00 【Gutie_bartholomew】
遇到个问题,我把这个问题简化了成了一个vi,里面是有2个确定按钮(机械动作:单击后触发),分别用事件结构(值改变)控制了一个灯亮起。
我希望能实现:我点一个按钮a后控制一个灯a亮起(代表了一些数据计算),这些计算的结果来判断,判断后让另一个按钮b也实现触发(另一个按钮的事件结构也是值改变),然后b灯亮起。这个过程中我只点了按钮a,看起来就是点了按钮a后又点了按钮b(实际上没点按钮b)
ps:因为一些原因,不能把a,b的值改变放到同一个事件分支中去,也不能把两个灯放到同一个事件结构里去。

当时没想明白,被迫换了一个程序写法,后来偶然在网上看到了一个大佬的系列,简直如同醍醐灌顶。
LabVIEW 无法捕捉由程序修改控件值产生的“值改变”事件_LabVIEW开发的博客-CSDN博客_labview输出值改变触发事件
在使用事件结构的时候,在事件分支中响应前面板中的一个显示控件的值改变事件,该显示控件在程序的其他部分动态改变其值。VI运行的时候,可以观察到显示控件值已经被改变了,但是对应事件分支却没有执行。为什么事件结构里没有响应显示控件的值改变事件呢?
解答:
事件结构仅仅注册由直接的前面板用户输入产生的事件,而在问题中,显示控件的值非用户输入而是程序更改的,所以这样的“值改变”LabVIEW不会去捕捉,因此也无法响应对应的事件分支。而且,即使你在程序中利用VI服务器,全局变量,局部变量等来改变VI和前面板控件,“值改变”事件都不会被LabVIEW捕捉。
有一个例外,输入控件和显示控件的事件可以通过调用值(信号)的属性节点产生。该属性是只写的,每次写入该属性节点就像是用户在前面板操作产生值的改变。要注意的是,在循环中使用该属性时,如果在循环迭代每一次都写入该属性,不管控件实际是否有值变化,程序将会产生一组的值改变事件。
参考下图的图片以及附件中的VI。

上例中,事件结构用来捕捉要连接到输入控件Numeric的Event Source 显示控件的“值改变”事件。
在事件结构的Numeric“值改变”分支中将Numeric的新值赋值给Event Source ,而不是在事件结构外直接将Numeric连线到Event Source,这样就可以避免每次Event Source 的值改变产生的“值改变”事件。一旦Numeric值改变了,对应的事件分支就会响应,通过 Event Source 的值(信号)属性节点便可产生 Event Source 的“值改变”事件,他对应的事件分支也执行了,如下图所示。

————————————————
版权声明:本文为CSDN博主「LabVIEW开发」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/bjcyck/article/details/124519385
边栏推荐
- Software test interview question: how to output "0001" when a number is known to be 1
- 【深度学习】视频分类技术整理
- How bad can a programmer be?
- access control
- People call this software testing engineer. You're just making a living (with HR interview Dictionary)
- Redis thing learning
- 从0开始写bootloader
- openresty lua-resty-dns 域名解析
- 海康设备接入EasyCVR,出现告警信息缺失且不同步该如何解决?
- 2022.07.11
猜你喜欢

EasyCVR平台关闭录像为何还会有TS切片文件生成?

JVS公众号登陆配置

A layered management method of application layer and hardware layer in embedded system

How bad can a programmer be?

When adding RTSP devices to easycvr platform, what is the reason for the phenomenon that they are all connected by TCP?

2022.07.11

Management of user organization structure

Jetpack compose performance optimization guide - compilation metrics

JVM overview and memory management (to be continued)
![[deep learning] video classification technology sorting](/img/bf/422d4ef342199966bbdaae06977699.png)
[deep learning] video classification technology sorting
随机推荐
Apple Mobile Bluetooth networking
Onion group joined hands with oceanbase to realize distributed upgrading, and global data has achieved cross cloud integration for the first time
Jetpack compose performance optimization guide - compilation metrics
Innovative cases | the growth strategy of digitalization of local life services and upgrading of Gaode brand
Summary of simple topics
创新案例 | 本地生活服务数字化,高德品牌升级的增长战略
Conversion of Oracle date
JVs privatization deployment start failure handling scheme
关于栈迁移的那些事儿
Babbitt | metauniverse daily must read: Tencent News suspended the sales service of digital collections, users left messages asking for a "refund", and phantom core also fell into the dilemma of "unsa
Office automation solution - docuware cloud is a complete solution to migrate applications and processes to the cloud
MySQL string function
I'm also drunk. Eureka delayed registration and this pit
IM即时通讯开发如何提升移动网络下图片传输速度和成功率
Redis 事物学习
Common methods of object learning [clone and equals]
Interviewer: what is the abstract factory model?
JVS公众号登陆配置
Idea: solve the problem of code without prompt
[benefit activity] stack a buff for your code! Click "tea" to receive the gift