*  ===============================================================
*        Sample BASIC program to process mouse coordinates
* 
*                            MOUSE.SCR
*  
*  Demonstrates the use of the MOUSE.SCR macro to respond to 
*  mouse input.
*  
*  
*           Copyright CLEARVIEW Software Inc. 1992, 1993
*                      All Rights Reserved
*  ===============================================================
* 
* 
* =================================================================
* Assign the API and mouse prefix strings 
* 
* Note: This example BASIC program will only work with mouse prefix
*       strings that are one character in length.   The program
*       could be modified to accept prefix strings up to the maximum
*       of 15 characters.
* =================================================================

EQU MAGIC TO CHAR(127)
EQU PREFIX TO "@"

* 
*  
* =================================================================
*  Send the API to Co*Star using the following output:
* 
*   Output                  Description
*   ---------------------   ---------------------------------------
*   MAGIC:"UWSCRIPT         API for executing external macro file.
* 
*   sdk\mouse.scr,          Path and filename for the macro file.
*    
*   prefix                  The mouse prefix string.
*
* =================================================================

 MOUSE=0
 R=10
 C=10                                 
 
 PRINT @(-1):
                                                      
 LOOP
   PRINT @(1,21):"Press MOUSE button or Q to quit. ":
   
   
   * Start the mouse macro
   PRINT MAGIC: "UWSCRIPTsdk\mouse.scr,":PREFIX: MAGIC:      
   
   * Get input string
   INPUT INKEY:      
   
   * Stop the mouse macro
   PRINT MAGIC: "UWSCRIPTSTOPsdk\mouse.scr": MAGIC: 
        
   PRINT @(-1):
                                   
   * Parse the returned coordinates and display an '*' at the clicked position
   MOUSE = INDEX( INKEY, PREFIX, 1 )
   IF MOUSE THEN
      COORD = RIGHT(INKEY, LEN( INKEY ) - 1 )
      R = FIELD(  COORD, ",", 1 )-1
      C = FIELD(  COORD, ",", 2 )-1
      PRINT @(C,R):"*":
      PRINT @(1,22):"Last MOUSE coordinates at (":R:",":C:")":
   END  

  UNTIL INKEY = "Q"
  REPEAT
  PRINT @(-1) 
     
END
