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