Hey there everybody, first of al thank you everyone who helped out with my first question and helped me solve that issue. I have another one for everyone now. So I am trying to make a button component invisible in Vision based on the value of a Boolean tag. What I need for it to do is to be visible when the associated tag is False and invisible when it is True. I tried to script it out, but alas I am still very very new to scripting, and can't quite figure it out. The following is what I scripted in a basic form.
"""Alpha is the associated Boolean Tag."""
"""Bravo is the Visibility property of the button."""
if Alpha == True:
Bravo == False
if Alpha == False:
Bravo == True
Is there an easier way to do this, or have I missed something due to my inexperience in scripting?
There is an easier way, just invert the tag value.
If you can use an expression, then use an expression. Scripting is a powerful tool, but it isn't always the best tool to use, and it shouldn't be the first choice.
Use an expression binding:
!{your tag path}
To do this in scripting you would do something like:
Also note that == does not perform assignment. If for some reason you couldn't use @lrose 's solution, you would have to edit your script at least like so:
if Alpha == True:
Bravo = False
if Alpha == False:
Bravo = True
I have your solution @lrose attached to a button for one of two units that are the same design in everything. When the OPCUA server on our test bench is open, I'll test it out.