Change position a JPG or PNG image

Hi, I need yours help.

I’m traying in runtime to change the position to a imagen file which is constantly changing, with a variable’s value. The problem is, I can´t find in the property editor the fiel “Position” to configure it directly.

With a SVG, Yes I can, but I can´t with a PNG.

Please, Help me. Maybe with a scrib code or another method.

In Vision, or Perspective?

Vision

You don’t bind a variable directly. You use system.gui.transform() to move the component. Typically you’d bind the tag that supplies position to a custom property, then use a propertyChange event script to issue the transform() call when that custom property changes.

I Do it like this

newx = system.tag.read('Prueba/Prueba_1/Variables/MW262').value

window = system.gui.getWindow("Paso")
text_1 = window.rootContainer.getComponent("Image")

system.gui.transform( text_1, newx)

But Now, I Have another problem. My Window Paso is my auxiliary monitor with Index 1. So my code doesn´t work in a timer scrip. I tried it in the Script Console with de windows edit open.

How can i select de window whent this code is running?

I’m working on ignition 7.9

Don’t use a tag event script. Don’t try to use .getWindow(). Just add a custom property to your image component. Call it “newX”, perhaps. Then, in that component, create a property change event that looks like this:

if event.propertyName=='newX':
	system.gui.transform(event.source, event.newValue)

On the newX property, use a tag binding to Prueba/Prueba_1/Variables/MW262.

3 Likes

It’s working! I am very grateful for your help