Window.monitor readonly property
Retrieves the characteristics of the monitor on which the window is located, as a table containing the following fields :
"name"
: astring
representing the display name"width"
: the monitor physical width as anumber
"height"
: the monitor physical height as anumber
"primary"
: aboolean
indicating if the monitor is the primary display
Example
local ui = require "ui"
--- create a centered Window
local win = ui.Window("Window.childs example", 320, 200)
win:center()
-- create 5 labels on this Window
for i = 1, 5 do
ui.Label(win, " Label"..i.." ", 140, (i+28)*i).bgcolor = 0x606060
end
async(function()
while true do
for widget in each(win.childs) do
widget.bgcolor = 0xFF0000
sleep(800)
widget.bgcolor = 0x606060
end
end
end)
ui.run(win):wait()