QB64.com

QB64 is a modern extended BASIC programming language that retains QBasic/QuickBASIC 4.5 compatibility and compiles native binaries for Windows, Linux, and macOS.

The _MOUSEMOVE statement moves the mouse pointer to a new position on the screen as determined by the column and row coordinates.

Syntax

_MOUSEMOVE column%, row%

Parameter(s)

Description

Availability

Example(s)

How to move the mouse cursor using remembered mouse movements. Press any key to quit.


SCREEN 12
i = _MOUSEINPUT 'start reading mouse events before INPUT to hold in memory
PRINT
INPUT "Move the mouse pointer and make a few clicks, then press Enter!", dummy$
_MOUSEMOVE 1, 1
DO: _LIMIT 30
    count = count + 1
    i = _MOUSEINPUT
    x = _MOUSEX: y = _MOUSEY
    b = _MOUSEBUTTON(1)
    PRINT count, x, y, b
    _MOUSEMOVE x, y
LOOP UNTIL i = 0 OR INKEY$ > ""
PRINT "Done!" 

Explanation: The _MOUSEINPUT function will hold previous and _MOUSEMOVE events so press any key when you want to quit.

Note: INPUT, INPUT$ and LINE INPUT will allow continued reading of mouse events while awaiting program user input! It is recommended that a WHILE _MOUSEINPUT: WEND loop be used immediately after to clear stored mouse events.

See Also