Mouse drag (event)

From ComputerCraft Wiki
Revision as of 00:32, 1 December 2012 by AfterLifeLochie (Talk | contribs) (Added example, this time I won't forget to filter. ;P)

Jump to: navigation, search
This page needs some serious TLC, stat!
Please help us by cleaning it, fixing it up, or sparing it some love.
(Reason: A demonstration on the use and handling of this event would be beneficial. AfterLifeLochie 16:00, 30 November 2012 (MSK))


Grid Modem.png  Event mouse_drag
Fired when the mouse is dragged (implies that a mouse_click event has already occurred).
Returned Object 1 The new X-coordinate of the mouse (in screen-characters).
Returned Object 2 The new Y-coordinate of the mouse (in screen-characters).

Examples

Grid paper.png  Example
Print the new co-ordinates of the mouse every time a mouse_drag event occurs.
Code
while true do
  xPos, yPos = os.pullEvent("mouse_drag")
  print("mouse_drag: X: " .. tostring(xPos) .. ", " ..
    "Y: " .. tostring(yPos))
end
Output The X and Y position of the mouse during the drag.

}}