LabVIEW:按下后,“确定"按钮不更新其颜色 [英] LabVIEW: OK Button doesn't update its color after pressed

查看:715
本文介绍了LabVIEW:按下后,“确定"按钮不更新其颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的VI,可以按一个按钮打开LED.我的代码工作正常,只不过我希望在按下后使按钮恢复为正常颜色.我尝试了所有的机械动作,但是没有一个动作可以完成我想要的动作.

Hi I have a simple VI to press a button to turn on the led. My code works just fine except I would like to have the button to be back to normal color after pressing. I tried all the mechanical actions, but none of them does what I want it to do.

过程如下:

  1. 在用户按下按钮之前先说,它像这样
  2. 用户按下按钮后,它变为
  3. 然后LED亮起
  4. 执行事件后,按钮将返回到

框图如下所示:

我很困惑,有人可以帮我吗?

I am puzzled and could someone please help me ?

推荐答案

闩锁"机械动作对您不起作用的原因是,闩锁布尔"上的值更改事件"不会触发其机械动作.为了触发机械动作,必须直接从程序框图上的布尔端子上读取. LabVIEW帮助中的将事件与锁存的布尔控件一起使用"中对此进行了说明.

The reason the Latch mechanical action isn't working for you is that a Value Change Event on a Latched Boolean will not trigger its mechanical action. In order to trigger the mechanical action, you have to read directly off the Boolean terminal on the block diagram. This is explained in the LabVIEW Help under "Using Events with Latched Boolean Controls".

如果要让布尔值闩锁,请确保将其设置为闩锁"机械动作,然后使用实际端子值打开/关闭布尔值指示器,而不是打开常数.我还向确定"按钮中添加了一个案例结构,以确保仅在启用确定按钮"时才更新布尔指示器.

If you want the boolean to latch, make sure its set to the Latching mechanical action, and then use the actual terminals value to turn the boolean indicator on/off rather than a constant. I've also added a Case Structure to the OK Button to ensure the boolean indicator is only updated when the "OK Button" is enabled.

这是一个VI片段,显示了运行中的闩锁.

Here's a VI Snippet showing the latch in action.

这篇关于LabVIEW:按下后,“确定"按钮不更新其颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆