I have a Spray nozzle component and a tag that dictates the Spray nozzle position.
I want the Spray nozzle to move down (relY) for every change in the tag
As I change the value of the tag from 0 to 60, I want it to change the position of Y from 420 to 480.
For example, if the value of tag=20, then the position of Y= 440
Is there an expression for this? Or do I have to write a script with a block of if statements?
It looks like you are going to have to do this with a custom property and scripting. The x and y positions aren’t in the binding (at least not for 7.5.11).
[quote=“adamaustin”]It looks like you are going to have to do this with a custom property and scripting. The x and y positions aren’t in the binding (at least not for 7.5.11).
You could try something like this:
The custom property is an integer and it is bound to the tag YourTag.
if event.propertyName == "relY":
system.gui.moveComponent(event.source, event.source.getX(), event.newValue + 420)
NOTE: The use of the “getX()” method here is unsupported by Inductive Automation and it may disappear in the future.[/quote]
I tried this too and it worked! My object already had an X and a Y property so I basically used an expression and incremented the tag by 420!