Resizing Component to match width of another Component

Hey everyone!

I am trying to resize one of my components to match the width of another component within the same window. Whether or not this happens is based on an if statement that is checking the roles of the users so I believe this would need to be done in runtime through scripting (unless you know of a better way :slight_smile:).

It would be great if there were someone way, function or call I could use to get the width of a component and then use that width for the width parameter in the resizeComponent() function which would make their width equal but as for as I know, there is no property for width of a component that I can access through scripting.

I’m sure this is possible. But I could really use some clarity!

Thank you for reading!

Have you tried .width ? While IA’s documentation may not call of this out, the components are all subclasses of Java Swing’s JComponent. There’s some complications with relative layout, but for this, just width ought to suit you.


I don’t mean to revive an old post, but .width is read only. My understanding is that you need to use the setSize(Dimension) method. I’ve tried using this however, as I want to be able to resize a trend based on if a fly-out tag browser is shown or not, but it doesn’t appear to do anything… no errors and no resizing.

This is what I’m testing with:

chart = event.source.getComponent('Easy Chart')
size = chart.getSize()
size.width = size.width - 200

Ok, so I can resize it using the Ignition function system.gui.transform(...), but what I don’t understand is the why of needing to use this, and why setSize(...) doesn’t work?

Layout. Size is ultimately controlled by the layout system. system.gui.transform() sets component properties that layout uses.