I have a plot with controls underneath it. I want to dynamically adjust the plot height to reveal these controls when someone clicks a button. In the designer, everything works flawlessly with the system.gui.transform function. When I open a client, the height always gets messed up.
Now, my actual code just takes the current height and scales it, so it will work regardless of screen size. The code below is just an example, but when I run it, the plot height is stretched beyond what is visible and the bottom of it can no longer be seen in the window. I haven’t changed the height…I am just copying and pasting the height it should currently be at…and yet the plot component shape changes.
plot_size = plot_comp.size
new_width = plot_size.width
Have you experimented with the different
coordSpace values (see system.gui.transform)?
Using the coordSpace arg doesn’t work…I have a docked popup and as soon as i resize that - causing the plot wind next to it to resize - everything falls apart. Just making the plot smaller, so cover the extreme case of a full-screen plot won’t work because it just ends up looking weirdly sized when the plot only takes up part of it.
Using the setSize method on the component sort of works, but if one of the controls under the plot is a button or if any of them change a plot feature the plot snaps back to its full size, covering the controls again…this would get pretty annoying for users, so I can’t accept that either.
Does it work as expected in client if you hard-code the two height values based on what they would be in Designer?
No…my bad for not saying…those images above are for when I tried using the hard-coded values and the designer coordinate space.
I recall running into something similar, but not the solution… so I’m guessing. Does it work right if you switch to relative layout for the chart?
Naahh…if i switch to relative layout on the plot, then when i re-adjust my docked popup window, the controls under the plot become visible even without clicking the button.
I am thinking i will probably have to give up on this and go for a sidebar on the right to show the controls…and just not bother with gui transforms and component resizing…kinda a bummer, because i thought this would look pretty cool this way.
I’m pretty sure what you want can be accomplished. If it’s getting messed up when area of container it is in changes, and you can’t find a way to make anchored layout and the transforms play nice, you may need to watch the size of the container/screen and manually handle all the size and position changes.