MOUSEMOVE: Difference between revisions
Jump to navigation
Jump to search
Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link
(Created page with "{{DISPLAYTITLE:_MOUSEMOVE}} The _MOUSEMOVE statement moves the mouse pointer to a new position on the screen as determined by the column and row coordinates. {{PageSyntax}} :_MOUSEMOVE {{Parameter|column%}}, {{Parameter|row%}} {{Parameters}} * {{Parameter|column%}} is the horizontal pixel coordinate to place the mouse pointer and can be any value from 0 to _WIDTH(0) - 1. * {{Parameter|row%}} is the vertical pixel position to place the m...") |
No edit summary |
||
(3 intermediate revisions by the same user not shown) | |||
Line 3: | Line 3: | ||
{{PageSyntax}} | {{PageSyntax}} | ||
:[[_MOUSEMOVE]] {{Parameter|column%}}, {{Parameter|row%}} | :[[_MOUSEMOVE]] {{Parameter|column%}}, {{Parameter|row%}} | ||
{{ | {{PageParameters}} | ||
* {{Parameter|column%}} is the horizontal pixel coordinate to place the mouse pointer and can be any value from 0 to [[_WIDTH (function)|_WIDTH]](0) - 1. | * {{Parameter|column%}} is the horizontal pixel coordinate to place the mouse pointer and can be any value from 0 to [[_WIDTH (function)|_WIDTH]](0) - 1. | ||
* {{Parameter|row%}} is the vertical pixel position to place the mouse pointer and can be any value from 0 to [[_HEIGHT]](0) - 1 | * {{Parameter|row%}} is the vertical pixel position to place the mouse pointer and can be any value from 0 to [[_HEIGHT]](0) - 1 | ||
Line 19: | Line 19: | ||
{{PageAvailability}} | |||
* '''Versions prior to 1.000''' (Version 1.000 had this function disabled for compatibility reasons.) | * '''Versions prior to 1.000''' (Version 1.000 had this function disabled for compatibility reasons.) | ||
* '''Version 1.1 and up''' | * '''Version 1.1 and up''' | ||
Line 40: | Line 40: | ||
{{Cl|_MOUSEMOVE}} x, y | {{Cl|_MOUSEMOVE}} x, y | ||
{{Cl|LOOP}} {{Cl|UNTIL}} i = 0 {{Cl|OR (boolean)|OR}} {{Cl|INKEY$}} > "" | {{Cl|LOOP}} {{Cl|UNTIL}} i = 0 {{Cl|OR (boolean)|OR}} {{Cl|INKEY$}} > "" | ||
{{Cl|PRINT}} "Done!" | {{Cl|PRINT}} "Done!" | ||
{{CodeEnd}} | {{CodeEnd}} | ||
: ''Explanation:'' The [[_MOUSEINPUT]] function will hold previous and _MOUSEMOVE events so press any key when you want to quit. | : ''Explanation:'' The [[_MOUSEINPUT]] function will hold previous and _MOUSEMOVE events so press any key when you want to quit. | ||
Line 49: | Line 49: | ||
{{PageSeeAlso}} | {{PageSeeAlso}} | ||
* [https://qb64phoenix.com/forum/showthread.php?tid=1141 Featured in our "Keyword of the Day" series] | |||
* [[_MOUSEX]], [[_MOUSEY]] | * [[_MOUSEX]], [[_MOUSEY]] | ||
* [[_NEWIMAGE]], [[_SCREENIMAGE]] | * [[_NEWIMAGE]], [[_SCREENIMAGE]] |
Latest revision as of 19:51, 24 May 2024
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%
Parameters
- column% is the horizontal pixel coordinate to place the mouse pointer and can be any value from 0 to _WIDTH(0) - 1.
- row% is the vertical pixel position to place the mouse pointer and can be any value from 0 to _HEIGHT(0) - 1
Description
- Maximum coordinate values are based on a program's current SCREEN mode resolution or the pixel size set by _NEWIMAGE.
- SCREEN 0 uses text block coordinates. Coordinates off the screen area will create an "Illegal Function Call" ERROR
- Can be used to position the pointer to a default dialog button or move the cursor away from a button so it is not clicked twice.
- Does not require _MOUSEINPUT to be used, but all moves will be remembered and can be read by mouse functions.
Availability
- Versions prior to 1.000 (Version 1.000 had this function disabled for compatibility reasons.)
- Version 1.1 and up
Examples
Example: 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