natiny.view.set_margin
natiny.view.set_margin(view, left, top, right, bottom)
Sets the space a view keeps between itself and the edges of its cell.
Parameters
| Name | Type | Description |
|---|---|---|
view |
number |
View handle |
left, top, right, bottom |
number |
Margin on each side, in drawing units |
Example
-- cards in a grid, 8 units apart from each other and from the grid's edge
local grid = natiny.view.create(natiny.view.GRID, root)
natiny.view.set_columns(grid, 4)
for i = 1, 8 do
local card = natiny.view.create(natiny.view.VERTICAL, grid)
natiny.view.set_margin(card, 4, 4, 4, 4)
end
natiny.view.set_padding(grid, 4, 4, 4, 4)