natiny.view.set_expand
natiny.view.set_expand(view, expand)
Sets whether a view takes the free space of its parent, sharing it equally with every sibling that expands too.
Parameters
| Name | Type | Description |
|---|---|---|
view |
number |
View handle |
expand |
boolean |
true to take the free space |
Example
-- a sidebar of fixed width and a content area taking the rest
local main = natiny.view.create(natiny.view.HORIZONTAL, root)
local sidebar = natiny.view.create(natiny.view.VERTICAL, main)
natiny.view.set_min_size(sidebar, 220, 0)
local content = natiny.view.create(natiny.view.FREE, main)
natiny.view.set_expand(content, true)
-- two panels splitting the rest in half
natiny.view.set_expand(left, true)
natiny.view.set_expand(right, true)
-- an empty view pushing the buttons after it to the right
local footer = natiny.view.create(natiny.view.HORIZONTAL, root)
local spacer = natiny.view.create(natiny.view.FREE, footer)
natiny.view.set_expand(spacer, true)
local cancel = natiny.view.create(natiny.view.FREE, footer)
local ok = natiny.view.create(natiny.view.FREE, footer)