Getting the correct width of an XY-panel

Hi!

Testing out Anvil and created a new App based on the Material Design template. Trying to distribute objects evenly in an xy panel, but the at the time I call the get_width method (in the show event of the xy panel) the width is not properly set. I get a width of 800 but the actual width is more like 400. I know this because if I call the method from the click event of a button (at this time the form is done loading completely) the width of the xy-panel is correct (around 400).

My question Is therefore, is there any way of getting the correct with of the xy-panel? Maybe an event that fires when the entire app /page/form is finished loading? I’ve tried the show-event of the form with no luck.

Can you share a clone of the app? Is it in a container that limits the size?

Hi @arbisteknik,

Yes, this is definitely a bug! get_width() in the show event should return the correct dimensions for the panel. If you can share a Clone link that demonstrates the problem, I’d be very grateful!

[Moved to the “Bug Reports” section]

Hey there,

You might be interested to know that we’ve now shipped an update to the XYPanel that should make it easier to use for fixed-size layouts. It now has a width control that defines a canvas area. You can then choose how the canvas area appears within the available space (by default it is centred). Hope that helps!

A post was split to a new topic: Making an XYPanel wider