Resizing Canvas Inside Flow Panel

Place a flow panel on a form, then add a canvas, then add a label.

If you programmatically change the width of the canvas, the label does not move right to make room, the canvas just overwrites the label.

It works if you resize the canvas in the editor using its handles.

What’s the code?

Generally speaking, Anvil components are given a width by their container. In this case, the width of the Canvas within the FlowPanel is a Container Property – in code, that’s a keyword argument you pass to add_component() – not a property of the Canvas itself.

Sorry, I didn’t post the link :

Yes, but the flowpanel expands the widget’s “slot” according to its size. For instance, it grows if you add text to a label. I think it should do the same for any component that can grow in size. Or maybe we should be able to “refresh” the flowpanel to allow it to resize itself.

Or am I just completely wrong? :slight_smile:

1 Like