Module goo.button

Button object

Functions

goo.button:onClick () Callback function when clicked
See goo.object:onClick()
goo.button:setText (text) Set the text of the button
goo.button:sizeToText (padding) Automatically size the button to fit the text.


Functions

goo.button:onClick ( )

Callback function when clicked
See goo.object:onClick()

Usage:

 local button = goo.button:new()
button.name = 'bob'
function button:onClick(x,y,button)
if button == 'l' then
print(self.name .. ' has been clicked')
end
end
-- when the button is clicked with left mouse button it prints:
-- bob has been clicked

goo.button:setText ( text )

Set the text of the button

goo.button:sizeToText ( padding )

Automatically size the button to fit the text.

Parameters

  • padding :number
    The inside padding, similar to CSS padding.

Valid XHTML 1.0!