mariuszl2 Posted November 16, 2011 Report Share Posted November 16, 2011 (edited) Hi, I have a small problem. I have three buttons in front panel and only one of them should be ON at the same time. Example: Button 1 is pressed when VI starts. When I press Button 2, Button 1 should switch OFF and so on. I`m using Event structure and references to do this, but when I make it into a subvi it has inputs for the references. Is there any other way to do it? I attached my Vi below. Hopefully it will give You understanding of what I`m trying to do. boolean test.vi Edited November 16, 2011 by mariuszl2 Quote Link to comment
jcarmody Posted November 16, 2011 Report Share Posted November 16, 2011 Have you considered using Radio Buttons? Quote Link to comment
crossrulz Posted November 16, 2011 Report Share Posted November 16, 2011 You could use OpenG's "Get Current VIs Parents Reference" to get a reference to the main VI and then use an invoke node to get/set the control's values using their label. The other option at the top of by head is to make an array of the references to pass into the subVI and the index of which control changed. Then use a for loop to set the others. 1 Quote Link to comment
Ton Plomp Posted November 17, 2011 Report Share Posted November 17, 2011 You could store the buttons in one cluster or array, and if a value change event is triggered you could XOR the old and the new values, that should only keep the changed button 'TRUE'. Further question is it possible to turn all buttons of? If so, the XOR trick won't work. TOn Quote Link to comment
mariuszl2 Posted November 18, 2011 Author Report Share Posted November 18, 2011 (edited) Further question is it possible to turn all buttons of? No. one button is always on. I think I`m gonna do it by inserting normal buttons inside Radio buttons. I didn`t know I can do that Edited November 18, 2011 by mariuszl2 Quote Link to comment
dannyt Posted November 22, 2011 Report Share Posted November 22, 2011 You could use OpenG's "Get Current VIs Parents Reference" to get a reference to the main VI and then use an invoke node to get/set the control's values using their label. The other option at the top of by head is to make an array of the references to pass into the subVI and the index of which control changed. Then use a for loop to set the others. Thank you, you lovely lovely person Two days ago I was writing something and I was thinking to myself, I am sure I have seen a VI somewhere that returned a parent's refernece, but could I find it. So of to rewrite my little VI, thanks again, Dannyt Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.