Mouse Commands
Logo offers commands to the check the position of the mouse and whether a mouse button has been pressed. You can also change the shape of the mouse.
BUTTON?
Also: BUTTONP
Reports the state of the left mouse button; no inputs.
Syntax
BUTTON?
Description
BUTTON? reports the state of the left mouse button. BUTTON? reports TRUE when the left button is depressed or FALSE when the button is not depressed.
See also MOUSE.
Examples
TO CHASE SETPOS MOUSE IF BUTTON? [STOP] CHASE END Result: CHASE defined CHASE
MOUSE
Reports the position of the mouse cursor; no inputs.
Syntax
MOUSE
Description
MOUSE reports the coordinates of the position of the mouse pointer as a list of two numbers representing the x coordinate and the y coordinate. The coordinates are relative to the center of the Graphics panel. See also BUTTON?, which reports whether the left mouse button is up or down.
Examples
TO CHASE SETPOS MOUSE IF BUTTON? [STOP] CHASE END Result: CHASE defined CHASE
MOUSESHAPE
Reports the shape of the mouse cursor; no inputs.
Syntax
MOUSESHAPE
Description
MOUSESHAPE reports the number of the current mouse pointer shape as defined with the SETMOUSESHAPE command. On startup, the mouse shape is 1.
Examples
MOUSESHAPE Result: 1
SETMOUSESHAPE
Sets the shape of the mouse cursor; expects between zero inputs and one input, but parentheses are needed if not called with one input.
Syntax
SETMOUSESHAPE number
(SETMOUSESHAPE)
Description
SETMOUSESHAPE changes the shape of the mouse cursor when it is within the Graphics panel. Its input is a number representing one of 17 available mouse shapes. When Logo starts, the mouse shape is 1. If SETMOUSESHAPE is enclosed in parentheses without inputs, shape 1 is used.
Note that the mouse shape only changes when the mouse hovers over the Graphics panel.
MOUSESHAPE reports the number of the current mouse shape.
Examples
SETMOUSESHAPE 2