


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:
01 MOUSE-INFO. 03 MOUSE-ROW PIC 9(4) COMP-4. 03 MOUSE-COL PIC 9(4) COMP-4. 03 LBUTTON-STATUS PIC 9. 03 MBUTTON-STATUS PIC 9. 03 RBUTTON-STATUS PIC 9.
The file "acugui.def" "contains a group item with this layout. 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 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.
find-mouse-menu-row.
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
else
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.