Link Search Menu Expand Document

StackView

A view that stacks its subviews either vertical (default) or horizontally.

The StackView will adjust its size on the (specified) main axis while preserving the size given for the other axis. It will also adjust the size of each subview to fill the other axis while preserving the subview size on the main axis.

You can put StackViews into Stackviews to create rows and columns

 rows = StackView(nil, "v")
 rows:addSubview(Label{text="Example"})
 cols = rows:addSubview(StackView(nil, "h"))
 cols:addSubview(Label{text="Col1"})
 cols:addSubview(Label{text="Col2"})
 rows:addSubview(Label{text="The End"})
 self:addSubview(rows)
 rows:layout()

Constructor

 my_button = StackView(bounds, axis)

Arguments

Name Type Description
bounds Bounds The StackView’s Bounds component
axis string The main axis to layout subviews on. “v” (default) or “h”

Returns

Nothing


Methods

StackView:margin (newValue)

Set the spacing between items

Arguments

Name Type Description
newValue number The space between subviews. nil to just return the current value.

Returns

Type Description
number The current value

StackView:layout ()

Layout the subviews

Arguments

None

Returns

Nothing