Hi All.
I’m looking to have UI elements (Buttons) inside a HLayout automatically wrap to the next line when their position exceeds the width of a View - either when the buttons are created or when the View / Window is resized.
In the past I’ve either used decorators with addFlowLayout or bounds coordinate positioning. However, I was hoping for a simpler way using the HLayouts / VLayouts. I’ve looked everywhere but can’t find an example showing this behaviour.
Any help would be greatly appreciated.
Thanks,
Christian
(
var win, cview, buts;
// Window
win = Window.new(bounds: Rect(100, 100, 800, 200));
win.front;
// Container
cview = View(parent: win, bounds: Rect(0, 0, 800, 200));
cview.resize = 5;
// Buttons
buts = { Button().fixedWidth_(80); } ! 10;
// Layouts
cview.layout = HLayout(
*buts
);
cview.layout.margins = 5 ! 4;
cview.layout.spacing = 5;
)