I have a template that show two labels depending on a value. If the value is 1, the label1 is shown and the other one is hidden, in contrast, when is 2, the label2 is shown and label1 is hidden. To do it, I am using the runScript function in the bindings in the labels’ visible property to read a bit of the tag.
That works but only when the window is shown at the first time, after that, if the value changes, nothing more happen. So, is there any way to update the value of the visible property to show or hid “online” depending on the tag value?.
It should be easy but it is taking me more time than I expected .
Your solution is the easiest, in my case, label 1 or 2 depend on a bit of a tag. To read specific bits in a tag, I am using a python function that return the value of a bit from a tag path. So, in order to evaluate the visible propertys I use an expression binding:
If the code is correct (I think so because it works the first time), my function is returning the bit value and the if condition evaluates it. But only one time, when the window is loaded.
Ah, I see I’ve done something very similar to what you’re doing.
In my case, I broke it down into 2 separate parts.
First I created a custom variable (let’s just call it test for simplicity) that I used indirect tagging to get the variable of the integer I wanted to read i.e.
[{1}]/ACT{2}
Then I substituted the param1 custom property in for ref#1 and param2 for ref#2.
Then on the visible property I used the following code
if(getBit({Root Container.test},1),True,False)
This will make it visible whenever bit 1 is 1 and invisible when bit 1 is 0
(Side note, I know that’s not really what you’re asking for per se, but that’s as far as my knowledge takes me right now for a viable workaround, sorry)