How can I display a value in a textbox indicator and a slider in LabVIEW?

≯℡__Kan透↙ 提交于 2019-12-23 16:26:09

问题


Is there a way to link two indicators on a LabVIEW front panel, so that they always have the same value? Right now I'm setting both to the same value every time, but it'd be much easier if there were a way to set up one to mirror the other.


回答1:


You can make the digital display visible. Right-click on the slider and select "Digital Display" from Visible Items.




回答2:


There are a few ways to achieve this, depending on how you are trying to display the data.

If you are just trying to update a slider and make a textbox indicator display the numeric value then by right clicking on the slider and selecting 'Visiable Items -> Digital Display' you will have a numeric indicator showing the value of the slider. This can then be repositioned as required. You should see if this meets your requirements as other methods will add complexity to your Block Diagram.

An alternate method would be using a network shared variable and binding the data although I think from your question this would be over kill.

You can also create an event structure to look for a value change event for the slider and update the text indicator accordingly. You would have to be careful how you update the slider as just wiring a value to the slider will not trigger an event for use a property node linked to the slider for the property 'value(signalling)'. Again this may be over the top for your application.




回答3:


Strictly speaking, no, you can't do that automatically. What you can do is set up an Event Structure and use the Value Changed events for each of the two controls to update the other. Just realize that the slider fires value changed events many times while the user is sliding it around, rather than just one event at the end. That may be what you want in this situation, however.




回答4:


I think this is not easily done, however there are some possibilities (as discussed). The general question is why? You have an indicator with the same info at two places. (or are they actual controls?) If you have two indicators, just place there terminals next to each other, just remember when you alter one of the two (via a local or by ref) to mimic the action for it's twin.

Using a value change event for both controls should work, just remember that you might get race conditions if you don't process the event directly.

Could describe a little bit further why you need two controls for the same action/value?

Ton



来源:https://stackoverflow.com/questions/535228/how-can-i-display-a-value-in-a-textbox-indicator-and-a-slider-in-labview

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!