Run time positioning of Controls on xy panel

We need to dynamically add controls and position them,

we can create a button and add to a xy panel but i cannot see how to set the position of it on the xy panel

I’m sure its obvious!

Does this help? XYPanel

brilliant, thanks, seems with anvil often its the opposite way around what I expect! can we reposition it after this?

I haven’t seen a way to do that directly.

Since an XYPanel is a container, it’s possible to remove a component, and re-add it at a new XY location. It will always be added at the level closest to the user, though, so if there is deliberate overlap (visible layering), that may not be what you want.

I imagine that a hidden XYPanel could be used as a “buffer”. For each component in Panel 1, detach it, and add it to Panel 2, at whatever xy position is desired. Then hide or destroy Panel 1, and make Panel 2 visible in its place. This approach could also work for changing the Z-order of components; you’d take care to remove them and add them in your desired order.

1 Like

the layering is fine we can do that with roles and z-index, works nicely on xy-panel, at some point we’d like to be able to smoothly drag elements around on a form in our own designer for the application.

1 Like