Mouse Demonstration and Test from TCL
MOUSE.TEST is a small PICK/BASIC utility that can be run from TCL, showing how the mouse can be used with HostAccess on your PC. We recommend that you also look at the PIX.MOUSE.TEST program to see how the code is structured (see Mouse test program).
MOUSE.TEST allows the user to move and click the mouse pointer over the current screen. Pressing and releasing the mouse button(s) cause a small box to appear around the position where the mouse button is pressed. The status line is also used to indicate which button you have pressed along with the column,row co-ordinates it was pressed at.
This program will only run if your PC supports a mouse through a mouse driver loaded into memory, or if you have Windows with a mouse. MOUSE.TEST will report an error message if no mouse is found.
This facility demonstrates just how powerful the mouse can be when your own software applications are in control.
Using MOUSE.TEST
MOUSE.TEST may be invoked from the TCL command line as follows:
MOUSE.TEST
The user should see a block cursor on the screen and, by moving the mouse, this cursor will move accordingly indicating the 'position of the mouse '. By clicking any of the buttons on the mouse, a small box is drawn and the status line will be updated to indicate what has happened.
By dragging the mouse while holding down a button, the status line is continuously updated. The co-ordinates are also displayed indicating where you released the mouse button.
One or more mouse buttons may be held down at the same time.
Press <RETURN> on the PC's keyboard to stop the MOUSE.TEST program and reset the screen.
MOUSE.TEST Applications Integration
MOUSE.TEST is a subroutine that calls the main mouse driving subroutines. The subroutines are PIX.MOUSE.AVAILABLE, PIX.MOUSE.ON, PIX.MOUSE.RESPONSE and PIX.MOUSE.OFF.
Two programs are provided with HostAccess that fully utilize the mouse. These are PIX.MOUSE.TEST (see Mouse test program) and PIX.CALC (see CALCIT - Pop Up Calculator). It is recommended that you examine these programs.
MOUSE.TEST Example Program
* * This program will activate the mouse and allow any of * the mouse buttons to be used. An '*' will be printed * anywhere on the screen that the mouse is pressed. * * Pressing <return> will cause BUTTON to return as false * which causes this program to stop. * MOUSE.FOUND = 0 * CALL PIX.MOUSE.AVAILABLE(MOUSE.FOUND) * IF NOT(MOUSE.FOUND) THEN PRINT "MOUSE NOT FOUND - ASK THE CAT!" STOP END * CALL PIX.MOUSE.ON("ALL,CONTINUOUS") * OLDX = 0 ; OLDY = 0 * LOOP CALL PIX.MOUSE.RESPONSE (KEYBOARD,BUTTON,XCORD,YCORD) WHILE BUTTON DO PRINT @(OLDX,OLDY):" ": PRINT @(XCORD,YCORD):"*": OLDX = XCORD ; OLDY = YCORD REPEAT * CALL PIX.MOUSE.OFF * END