Panel.align
Get or set the Panel alignment, which position and size will be aligned relative to its parent (alignment persists even if the size of the parent changes).
This property uses a string to specify the Panel alignment :
- "all" : the Panel will be aligned along all the parent borders (and will cover the entire parent client area).
- "bottom" : the Panel will be aligned along the bottom border of the parent, preserving its height.
- "top" : the Panel will be aligned along the the top border of the parent, preserving its height.
- "right" : the Panel will be aligned along the right border of the parent, preserving its width.
- "left" : the Panel will be aligned along the left border of the parent, preserving its width.
Example
--! luart-extensions
import ui
-- create a fixed Panel
local win = ui.Window("Panel:align() sample", 320, 200)
-- create a blue Panel
local panel = ui.Panel(win, 0, 0, 100, 100)
panel.bgcolor = 0x00ace6
-- align the Panel to the bottom of its parent
panel.align = "bottom"
-- create a centered Label inside the Panel
local label = ui.Label(panel, "I'm a bottom aligned Panel")
label.align = "all"
label.textalign = "center"
await win:showasync()