Enable the software mouse cursor, choose its icon, and install pointer event handlers. Coordinates are HDMI screen pixels with (0,0) at the top-left, the same space MM.INFO$ and PAINT use.
MOUSE ON MOUSE OFF MOUSE CURSOR [type]
type - pointer (default), hand, crosshair, questionmark, deny, hidden, or
0..5 in that order.
MOUSE ON draws a cursor at the current pointer position while a program runs. MOUSE OFF hides it. The cursor is composited over the finished frame and never writes to a PAGE buffer, so moving the pointer cannot change page pixels or interrupt drawing across multiple pages.
Use MOUSE CURSOR hidden (type 5) to keep reading the pointer position and buttons – MOUSE(x), MOUSE(y) and the ON MOUSEMOVE / ON MOUSECLICK / ON MOUSEDOWN / ON MOUSEUP handlers all keep working – while no cursor sprite is drawn. This lets a program draw its own pointer, or none at all.
Pointer events call SUB handlers installed with ON:
ON MOUSECLICK handler
ON MOUSEDOWN handler
ON MOUSEUP handler
ON MOUSEMOVE handler
ON MOUSEDOWN is an alias of ON MOUSECLICK: both fire on a button press. ON MOUSEUP fires when the button is released. Press and release handlers receive the screen position and button:
SUB click(x, y, button$)
PRINT x, y, button$ ' button$ is "left", "middle" or "right"
END SUB
The move handler receives the new position:
SUB move(x, y)
PRINT x, y
END SUB
Example:
MOUSE ON
MOUSE CURSOR crosshair
ON MOUSEMOVE move
ON MOUSECLICK click
ON MOUSEUP release
DO
PAUSE 10
LOOP
Source: docs/help/mouse.txt inmmcore. On the computer, typeHELP MOUSE.