diff --git a/docs/events/mouseEvents.md b/docs/events/mouseEvents.md index d113114..66be726 100644 --- a/docs/events/mouseEvents.md +++ b/docs/events/mouseEvents.md @@ -46,7 +46,7 @@ button:onClickUp(buttonOnRelease) # onScroll `onScroll(self, direction, x, y)`
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: @@ -61,3 +61,22 @@ function buttonOnScroll() end button:onScroll(buttonOnScroll) ``` + +# onDrag +`onDrag(self, x, y)`
+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) +```