Label:autosize() method
Resize the Label automatically to accommodate its contents.
Return value
This function returns no value.Example
local ui = require "ui"
-- create a simple Window
local win = ui.Window("Label:autosize() sample", 320, 200)
-- add a tiny Label...
local label = ui.Label(win, "LuaRT", 130, 80)
-- ...with a big font
label.font = "Impact"
label.fontsize = 18
-- resize to a small label
label.width = 20
label.height = 16
-- ...and a Button
ui.Button(win, "Show Label.text", 100, 10).onClick = function (self)
label:autosize()
self.enabled = false
end
win:show()
-- update the user interface until the user closes the Window
repeat
ui.update()
until not win.visible