When setting the value to
false
, the button's text value is lost.Button.hastext read/write property
Get or set the button's text visibility on screen, a true value means that the text is shown, a false value means that the text is hidden.
Example
local ui = require "ui"
-- create a simple button
local win = ui.Window("Button.hastext sample", 320, 200)
local button = ui.Button(win, "Click me !")
button:loadicon(sys.env.WINDIR.."/system32/shell32.dll", 44)
button:center()
-- hides the button when mouse cursor hovers it
function button:onClick()
self.hastext = not self.hastext
if self.hastext then
self.text = "Click me !"
end
button:center()
end
win:show()
-- update the user interface until the user closes the button
repeat
ui.update()
until not win.visible