Hi, I’m trying to resize proportionally all the components in a window using a slider.
I succeed in resizing only the main window, but I would resize even the contained components.
In order to do this, I think that I need a method to iterate a component that belongs to a rootContainer, for instance something like that:
window = system.gui.getWindow("Win")
components = window.getRootContainer().getComponents()
for c in components:
system.gui.resizeComponent(c, width, height)
It is possibile to do something like that? I have searched in the support website but without success.
Yes, you can iterate through a container’s components with the loop you show. To be sure you catch everything in a window, you’ll need to do so recursively for containers within containers.
As to your problem: I’m not exactly sure what you are trying to achieve, but you’ll need to capture the original sizes of all of these components in order to apply a scaling factor. Your position is likely to need to change, too, not just size. Is there a reason the normal relative layout won’t work for you?
yes you are right, I had some problems in the layout settings, now it works fine with the following code
sizeMod = (float(event.source.value) / 100)
if(sizeMod == 0):
sizeMod = 0.0001
event.source.parent.getComponent('Text Field').text = str(sizeMod)
window = system.gui.getWindow("PortaaMareZonaA")
if(sizeMod > event.source.lastValue):
window.setSize(int((window.width) + window.width * sizeMod), int((window.height) + window.height * sizeMod))
window.setSize(int((window.width) - window.width * sizeMod), int((window.height) - window.height * sizeMod))
event.source.lastValue = sizeMod
However, when I zoom the Ignition Window content beyond the window’s size, I would like the window scrollbars to appear. How can I achieve this? thanks
[quote=“DanCas”]However, when I zoom the Ignition Window content beyond the window’s size, I would like the window scrollbars to appear. How can I achieve this? thanks[/quote]Hmm. The application’s scroll bars should appear as soon as any part of the window’s outline exceeds the app window boundary. Windows within the app are not capable of displaying scroll bars.