GET-MOUSE-STATUS (op-code 1)

Returns information about the mouse's location and the state of each of its buttons. You must pass a group item with the following structure (defined in acugui.def):

   03  MOUSE-ROW               PIC 9(4) COMP-1.
   03  MOUSE-placeStateCOL               PIC 9(4) COMP-1.
   03  LBUTTON-STATUS          PIC 9.
       88  LBUTTON-DOWN        VALUE 1.
   03  MBUTTON-STATUS          PIC 9.
       88  MBUTTON-DOWN        VALUE 1.
   03  RBUTTON-STATUS          PIC 9.
       88  RBUTTON-DOWN        VALUE 1.
   03  MOUSE-ROW-EX            PIC 9(6)V99 COMP-4, SYNC.
   03  MOUSE-placeStateCOL-EX            PIC 9(6)V99 COMP-4.
   03  MOUSE-ROW-PIXEL         PIC 9(8) COMP-4.
   03  MOUSE-placeStateCOL-PIXEL         PIC 9(8) COMP-4.

The routine fills in this structure with data about the mouse. Each of the three status"fields is set to 1 if the corresponding button is depressed. Otherwise, they are set to zero. The various row and column fields are set to the location of the mouse within the current ACUCOBOL-GT window. If the mouse is outside of the current window, then these values are set to zero.

Here's an example of a call to W$MOUSE that returns the menu item the mouse is pointing to:

* find-mouse-menu-row - returns (in mouse-row) 
* the menu item that the mouse pointer is 
* currently on. If the mouse is not on a menu 
* item, it returns zero.

   call "w$mouse" using get-mouse-status, mouse-info 
   if mouse-row >= menu-row and 
         mouse-row < menu-row + num-menu-items * 2 
      compute mouse-row = mouse-row - menu-row + 1 
      move zero to mouse-row.

After an ACCEPT statement is executed, all CALLs to W$MOUSE pertain to that ACCEPT statement, until another ACCEPT is executed. So, you always get the right mouse status. By synchronizing the mouse actions with the appropriate exception values, the runtime ensures that you process the mouse correctly.