Introduction | Language Structure | IB Statements | File System | Comet 32 Runtime | Index |
The following outline provides the basic steps for reading the mouse and interpreting the 4 bytes that are returned by the mouse driver:
LENGTH 2 & LOCAL MOUSECURSOR$
LENGTH 1 & LOCAL MOUSECLICK;MOUSESTATE$
MOUSE.INFO: FORMAT MOUSECURSOR$;MOUSECLICK;MOUSESTATE$
.
READ (0,MOUSE.INFO)
ROW=ASC(MOUSECURSOR$)þ1
COLUMN=ASC(SUB(MOUSECURSOR$,2,1))
BUTTON=ASC(MOUSECLICK$)
MOUSESTATE=ASC(MOUSESTATE$)
| Value | Button |
|---|---|
| 1 | Left |
| 2 | Right |
| 3 | Left and right |
| 4 | Center |
| 5 | center and left |
| 6 | Center and right |
| 7 | All three |
| Value | State |
|---|---|
| 1 | Left button down |
| 2 | Right button down |
| 4 | Center button down |
Your program can utilize this information in whatever manner you choose. You can establish "hot" zones on the screen where a mouse click will cause some specific action to take place, you can test for different mouse buttons (up or down), and you can use the enhanced graphics characters to display items such as radio buttons and check boxes.