我需要建一个子vi,但vi中有可见和位置的属性节点,生成子vi后,原来的属性节点都不起作用,请问有什么方法
如图,原来要实现的功能是让布尔和布尔2重合,随输入数值确定是否可见,但生成子vi后,就不能实现这些功能了,路过的大神指教一下
已解决! 转到解答。
从图上分析,似乎是要在子VI中,利用属性节点修改主VI中的控件属性,那这样做是无法实现的。
子VI修改主VI中的控件,不能直接采用数据流方式,应该传入控件的引用到子VI中。这类似于C语言中的指针传递和值传递之间的区别。
哎,谢谢了,看来只能一个一个的重复写了,
呵呵,再问你个问题,在vi中利用用颜色属性节点,是布尔在case不同的情况下显示不同的颜色,可是我把布尔控件自定义后,改成了其他的形状,颜色就不改变了,应该怎么解决呢
Please also see this similar post 顶层界面如何与子VI的数据实现同步显示。
The example uses Refnum (Reference) for updating caller's control/ indicator with sub-VI's data at runtime.
Thanks for your answer to my question. I have solved the question. However, I 遇到这样一个情况
第一个是直接调用的引用句柄函数(refnum),第二个是使用右键->创建->属性节点->引用实现的,结果,第一个就没问题,第二个就报错,
Please Take a look at this post.
thank you all the same. The question was come across in the process that I design my program according to your method. I found that the first version was right but the second wrong. So I don't know the difference between them. Now I have known.
However ,another problem appears. Please look at the three following picture. The first is your example ,and the second is my own design.The third is my sub_vi.我的程序出现了强制类型转换。我查到,为了优化程序,程序中应该尽量避免转换。
         
 Without looking at your sub VI, one quick way to fix this is...
From the Booleans' references, right-click and create (Reference) Controls. Copy and paste these (Reference) Controls to your sub VI, and use them as Inputs to your sub VI.