docs update

Updated some docs stuff
This commit is contained in:
Robert Jelic
2022-10-09 12:05:30 +02:00
parent 44402b1d26
commit 1d3e2018ef
13 changed files with 228 additions and 7 deletions

View File

@@ -0,0 +1,27 @@
# onRelease
`onRelease(self, event, button, x, y)`<br>
The computercraft event which triggers this method is `mouse_up`.
The difference between onRelease and :onClickUp is that :onRelease is called even when the mouse is no longer over the object, while :onClickUp is only called when the mouse is over the object.
Here is a example on how to add a onRelease 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(self, button, x, y)
basalt.debug("Button got clicked!")
end
button:onClick(buttonOnClick)
function buttonOnRelease(self, button, x, y)
basalt.debug("Button got released!")
end
button:onRelease(buttonOnRelease)
```