E> For N=150 To 300 X Mouse=N : Y Mouse=N/2 Print X Mouse : Print Y Mouse Next N
MOUSE KEY
function: read status of mouse buttons
k=Mouse Key
The MOUSE KEY function checks whether one of the mouse buttons has been pressed and makes a report in the form of a binary pattern made up of these elements:
Pattern Report Bit 0 Left mouse button Bit 1 Right mouse button Bit 2 Third mouse button if it exists
As usual, the numbers zero and one make up the report, with a one displayed when the relevant button is held down, otherwise a zero is shown. Try this routine:
E> Curs Off Do Locate 0,0 M= Mouse Key : Print "Bit Pattern ";Bin$(M,8);" Number ";M Loop
MOUSE CLICK
function: check for click of mouse button
c=Mouse Click
This is similar to MOUSE KEY, but instead of checking to see whether or not a mouse button is held down, MOUSE CLICK is only interested in whether the user has just made a single click on a mouse button. It returns the familiar bit pattern of these elements:
Pattern Report Bit 1 Single test for left mouse button Bit 2 Single test for right mouse button Bit 3 Single test for third mouse button, if available
These bits are automatically re-set to zero after one test has been made, so they will only check for a single key press at a time. Here is an example:
E> Curs Off Do M=Mouse Click If M<>0 Then Print "Bit Pattern ";Bin$(M,8);" Number";M Loop