LoveFrames/demo/examples/button.lua
2019-03-06 23:19:58 +00:00

28 lines
662 B
Lua

local example = {}
example.title = "Button"
example.category = "Object Demonstrations"
function example.func(loveframes, centerarea)
local frame = loveframes.Create("frame")
frame:SetName("Button")
frame:CenterWithinArea(unpack(centerarea))
local button = loveframes.Create("button", frame)
button:SetWidth(200)
button:SetText("Button")
button:Center()
button.OnClick = function(object, x, y)
object:SetText("You clicked the button!")
end
button.OnMouseEnter = function(object)
object:SetText("The mouse entered the button.")
end
button.OnMouseExit = function(object)
object:SetText("The mouse exited the button.")
end
end
return example