1.1 KiB
1.1 KiB
The button object is for creating buttons If you click on them, they should execute something. You decide what should happen when clicking on them.
Object methods also apply for buttons.
| setText | Changes the button text |
| setHorizontalAlign | Changes the horizontal text position |
| setVerticalAlign | Changes the vertical text position |
Example
This is a example on how you would create a fully working button:
local main = basalt.createFrame()
local aButton = main:addButton():setText("Click")
aButton:onClick(function(self,event,button,x,y)
if(event=="mouse_click")and(button==1)then
basalt.debug("Left mousebutton got clicked!")
end
end)
and this would be the xml way:
basalt.setVariable("buttonClick", function(self,event,button,x,y)
if(event=="mouse_click")and(button==1)then
basalt.debug("Left mousebutton got clicked!")
end
end)
local main = basalt.createFrame():addLayout("example.xml")
<button onClick="buttonClick" text="Click" />