Update mouseEvents.md
This commit is contained in:
@@ -46,7 +46,7 @@ button:onClickUp(buttonOnRelease)
|
|||||||
# onScroll
|
# onScroll
|
||||||
`onScroll(self, direction, x, y)`<br>
|
`onScroll(self, direction, x, y)`<br>
|
||||||
The computercraft event which triggers this method is `mouse_scroll`.
|
The computercraft event which triggers this method is `mouse_scroll`.
|
||||||
Any visual object can register a onScroll events.
|
Any visual object can register onScroll events.
|
||||||
|
|
||||||
Here is a example on how to add a onScroll event to your button:
|
Here is a example on how to add a onScroll event to your button:
|
||||||
|
|
||||||
@@ -61,3 +61,22 @@ function buttonOnScroll()
|
|||||||
end
|
end
|
||||||
button:onScroll(buttonOnScroll)
|
button:onScroll(buttonOnScroll)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
# onDrag
|
||||||
|
`onDrag(self, x, y)`<br>
|
||||||
|
The computercraft event which triggers this method is `mouse_drag`.
|
||||||
|
Any visual object can register onDrag events.
|
||||||
|
|
||||||
|
Here is a example on how to add a onDrag event to your button:
|
||||||
|
|
||||||
|
```lua
|
||||||
|
local basalt = dofile("basalt.lua")
|
||||||
|
|
||||||
|
local mainFrame = basalt.createFrame("myMainFrame"):show()
|
||||||
|
local button = mainFrame:addButton("myButton"):setPosition(3,3):setSize(12,3):setText("Click"):show()
|
||||||
|
|
||||||
|
function buttonOnDrag()
|
||||||
|
basalt.debug("Someone drags me (i know i wont reposition myself)!")
|
||||||
|
end
|
||||||
|
button:onDrag(buttonOnDrag)
|
||||||
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user