Binding/Animating size/position within container

Hi all,

Setting up a popup to control a motor, and my motor UDT has a parameter which defines whether it’s reversible or not. If not, I show just two buttons; Start and Stop. If it is reversible, I display three: Start Forward, Stop, Start Reverse.

What I’d ideally like is for the buttons to take up the same amount of space whether there are two or three. So, if there are two buttons, they’d either re-size to take up the full width, or at least re-position slightly to stay centred. Is it possible to do this dynamically? In any other SCADA package I’d just make 5 buttons and switch between them using visibility animations as necessary, but I’d like to think there’s a neater way of doing it in Ignition!

You can use system.gui.transform() to resize or move the buttons you want. You would probably do this in a visionWindowOpened script. If you just want to move them to center, you could move them with object.x =newX.

Something like that.

1 Like

Thanks! That’s exactly what I was looking for.

Hi All,
Looks like this solution would apply to my situation as well. Although I am not sure how I would hook up the script to be called. Where is the visionWindowOpened event on the window? And what if I have a template I would like to the same for?

Would appreciate an example of how to call the script. Thanks.

Right-click on window in Project Browser tree and choose Scripting... (window must be open). Expand the visionWindow folder in the Component Scripting window that pops up to find visionWindowOpened event and tap on the Script Editor tab.

1 Like

Thanks, that worked!

1 Like