natiny.view.set_max_size
natiny.view.set_max_size(view, width, height)
Sets the largest size a view is given: by its content, by filling its cell, or by expanding.
Parameters
| Name | Type | Description |
|---|---|---|
view |
number |
View handle |
width |
number |
Maximum width in drawing units; 0 for no limit |
height |
number |
Maximum height in drawing units; 0 for no limit |
Example
-- a menu as tall as its buttons, never wider than 420, in the middle
local screen = natiny.view.create(natiny.view.CENTER)
local menu = natiny.view.create(natiny.view.VERTICAL, screen)
natiny.view.set_padding(menu, 24, 24, 24, 24)
natiny.view.set_gap(menu, 0, 10)
natiny.view.set_min_size(menu, 300, 0)
natiny.view.set_max_size(menu, 420, 0)