Unmasking Mouse Actions

Normally, you don't want every mouse action to return an exception value to your program. For example, you usually don't need to know that the user moved the mouse. Having to program for that case for each ACCEPT statement would be very tedious. For this reason, ACUCOBOL-GT allows you to mask out (ignore) some or all of the mouse actions in any combination. By default, all of the mouse actions are masked — you must enable the actions that you want to use.

You control which mouse actions you want to handle by setting the value of the configuration variable MOUSE-FLAGS. The value you set is actually one or more values added together.

Each numeric value shown in the mouse actions table also has a descriptive name (such as arrow-left-down). Note that these descriptive names come from the file acugui.def. If you use these descriptive names in your program, add this statement to the Working-Storage section of your program:

copy "acugui.def"

The possible values are:

AUTO-MOUSE-HANDLING Value 1. Causes ACUCOBOL-GT to useits automatic mouse handling facility. This is described in detail below. (default)
ALLOW-LEFT-DOWN Value 2. Enables the left button pushed action.
ALLOW-LEFT-UP Value 4. Enables the left button released action.
ALLOW-LEFT-DOUBLE Value 8. Enables the left button double-clicked action
ALLOW-MIDDLE-DOWN Value 16. Enables the middle button pushed action.
ALLOW-MIDDLE-UP Value 32. Enables the middle button released action.
ALLOW-MIDDLE-DOUBLE Value 64. Enables the middle button double-clicked action.
ALLOW-RIGHT-DOWN Value 128. Enables the right button pushed action.
ALLOW-RIGHT-UP Value 256. Enables the right button released action.
ALLOW-RIGHT-DOUBLE Value 512. Enables the right button double-clicked action.
ALLOW-MOUSE-MOVE Value 1024. Enables the mouse moved action.
ALWAYS-ARROW-CURSOR Value 2048. Forces the mouse pointer always to be the default arrow shape when you are using automatic mouse handling. If this is not set, then the shape of the mouse pointer varies depending on various configuration options. This is described in detail below.
ALLOW-ALL-SCREEN-ACTIONS Value 16384. This causes all enabled mouse actions that occur within your application’s window to be acted upon. If this is not set, then only mouse actions that occur within the current ACUCOBOL-GT window are acted upon. (The current ACUCOBOL-GT window is a window created by your program with the DISPLAY WINDOW verb.)

For example, if you wanted to act on the user's pressing either the left or right buttons, you could do the following in COBOL:


You may also set the MOUSE-FLAGS variable directly in the COBOL configuration file. The following entry in the configuration file would produce the same results as the example shown above:


See the list above for the numeric values associated with each setting.

The default setting of MOUSE-FLAGS is 1 (AUTO-MOUSE-HANDLING).