The height property represent the height of the client area of the window, excluding the title bar.
Window.height read/write property
Get or set the Window's height. The height starts from 0 (top side of the Window) and increase to the bottom direction.
Example
local ui = require "ui"
-- create a simple window
local win = ui.Window("Window.height sample", 320, 200)
local label = ui.Label(win, "")
local start_btn = ui.Button(win, "Grows it !", 70, 50)
local stop_btn = ui.Button(win, "Stop", start_btn.x+100, start_btn.y)
local growing = true
local function onClick()
growing = not growing
stop_btn.enabled = growing == true
start_btn.enabled = growing == false
end
function win:onResize()
win:status("Window height : "..win.height)
end
start_btn.onClick = onClick
stop_btn.onClick = onClick
-- update status bar
win:onResize()
-- update buttons
onClick()
-- Keep increasing Window with
async(function()
while(true) do
if growing then
win.height = win.height + 1
end
sleep(10)
end
end)
ui.run(win):wait()