Jump to content

Dependend Buttons


Recommended Posts

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,

boolp.jpg

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 by mariuszl2
Link to comment

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.

post-11268-0-27660200-1321465412.png

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.

  • Like 1
Link to comment

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

Link to comment

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.

post-11268-0-27660200-1321465412.png

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 :worshippy:

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

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.