This button is to a Pop Up Window. I would like for this to be disabled if a bool value = 0 and enabled if that same bool value = 1
The problem is the button always enables the Pop Up Window no matter the bools status.... I have the Enabled expression for that button written as so....
{[default]AZ ASRS Conveyor System/Wave Control/C7-1 BB1001A/N701:13_2.value}= "1"
Don't use an expression binding at all. Bind the enabled property directly to the tag in question.
The binding will automatically coerce 0 as false, and any other number as true; if your tag is essentially a boolean but has an integer data type, that should give you the behavior you want.
If you do want to do it with an expression (you shouldn't - it's slower, for zero gain), you need to be sure your data types match.
{[default]AZ ASRS Conveyor System/Wave Control/C7-1 BB1001A/N701:13_2.value}= "1"
Is comparing a tag value that is presumably an integer with a string ("1"
).
Even if the string contains only a single numeric digit, neither our expression language nor Python will do any automatic coercion from string to number or vice versa; that way lies madness.
What would probably work (again, I'm just assuming your tag is actually an integer):
{[default]AZ ASRS Conveyor System/Wave Control/C7-1 BB1001A/N701:13_2} = 1
5 Likes
I bind the enabled property to the tag directly and the POP UP WINDOW still enables no matter the tag status. I may be missing something very basic.....
Also, make sure you are using the "actionPerformed" event of the button. The other events, like mouse clicks, do not honor the enable/disable status.
8 Likes
YES!! That's what was missed!! Awesome TY!!
I saw the blue text on 'that way lies madness' and immediately knew "this is going to be a JS link, and I hope it's Wat" and was not disappointed
1 Like