Difference between revisions of "MOUSEWHEEL"
(Created page with 'The '''_MOUSEWHEEL''' function returns an INTEGER value which can be negative or positive or 0. ''Syntax:'' scroll% = _MOUSEWHEEL * Positive values represent how many "cl…')
|(35 intermediate revisions by 3 users not shown)|
|Line 1:||Line 1:|
The _MOUSEWHEELfunction returns [[INTEGER]] value .
: %= _MOUSEWHEEL
* up .
* has been .
* the last [[_MOUSEINPUT]] ,
Latest revision as of 17:46, 9 September 2017
- scrollAmount% = _MOUSEWHEEL
- Returns -1 when scrolling up and 1 when scrolling down with 0 indicating no movement since last read.
- After an event has been read, the value resets to 0 automatically so cumulative position values must be added.
- If no movement on the wheel has occurred since the last _MOUSEINPUT read, _MOUSEWHEEL returns 0.
Example 1: Reading the cumulative mouse wheel "clicks".
Example 2: A simple text scrolling routine using the mouse wheel value to read a text array.
DIM Array$(100) LINE INPUT "Enter a file name with 100 or more lines of text: ", file$ OPEN file$ FOR INPUT AS #1 DO UNTIL EOF(1) inputcount = inputcount + 1 LINE INPUT #1, Array$(inputcount) IF inputcount = 100 THEN EXIT DO LOOP FOR n = 1 TO 21: PRINT Array$(n): NEXT CLOSE #1 DO DO WHILE _MOUSEINPUT IF row >= 0 THEN row = row + _MOUSEWHEEL ELSE row = 0 'prevent under scrolling IF row > inputcount - 20 THEN row = inputcount - 20 'prevent over scrolling IF prevrow <> row THEN 'look for a change in row value IF row > 0 AND row <= inputcount - 20 THEN CLS: LOCATE 2, 1 FOR n = row TO row + 20 PRINT Array$(n) NEXT END IF END IF prevrow = row 'store previous row value LOOP LOOP UNTIL INKEY$ > ""