Updated docs
There is still stuff to do
This commit is contained in:
20
docs/objects/Object/onClick.md
Normal file
20
docs/objects/Object/onClick.md
Normal file
@@ -0,0 +1,20 @@
|
||||
# onClick
|
||||
`onClick(self, event, button, x, y)`<br>
|
||||
The computercraft event which triggers this method is `mouse_click` and `monitor_touch`.
|
||||
|
||||
Here is a example on how to add a onClick event to your button:
|
||||
|
||||
```lua
|
||||
local basalt = require("basalt")
|
||||
|
||||
local main = basalt.createFrame()
|
||||
local button = main:addButton()
|
||||
:setPosition(3,3)
|
||||
:setSize(12,3)
|
||||
:setText("Click")
|
||||
|
||||
function buttonOnClick()
|
||||
basalt.debug("Button got clicked!")
|
||||
end
|
||||
button:onClick(buttonOnClick)
|
||||
```
|
||||
Reference in New Issue
Block a user