ContentsIndexPreviousNext

HOT_KEY*

ACUCOBOL-GT offers two methods for assigning hot keys - the HOT_KEY variable, described here, and the KEYSTROKE hot-key format described in the The KEYSTROKE Variable section of the "Setting Up Your Terminals" chapter.

Using the HOT_KEY variable described below, you can easily assign a whole range of keys to a single hot-key program and determine which key activated the program. This lets you write a single program that handles an entire menu. Each menu item can act as a "hot key" to call this program.

This HOT_KEY format differs from the KEYSTROKE hot-key described in the "Setting Up Your Terminals" chapter in three ways:

Use the HOT_KEY variable to associate an exception value, or range of values, with a program. HOT_KEY has the following format:

HOT_KEY  program = value1 [, value2]

where program is the name of the program to run, value1 is the lower (or only) exception value that activates the program, and value2 is the upper value of the activation range. Value2 may be omitted; if it's used, it must include the separating comma. You must place program in single or double quotes if you require a lower-case program name. For example, to assign a program called "mymenu" to exception values 100 through 200, use the following entry:

HOT_KEY  "mymenu" = 100, 200

Remote name notation is allowed for the HOT_KEY variable if your runtime is client-enabled.

Multiple HOT_KEY entries may reference the same program. This allows you to specify non-contiguous activation ranges. (Be aware that no more than 16 hot-key entries can be included in the COBOL configuration file. Using a contiguous range of exception values assigns many keys while counting as only one entry towards the limit.)

If you specify a value1 value of "0", then all hot-key references to program are removed. Within a given run unit, this is the only way to remove the assignment of an exception value to a hot-key program after it has been assigned. You will probably use SET ENVIRONMENT in your source code to do this.

If you assign multiple hot-key programs to the same exception value, the results are undefined.

You may assign different hot keys using both the HOT_KEY variable, described here, and the KEYSTROKE hot-key format described in the "Setting Up Your Terminals" chapter. The results are undefined if you assign the same key using both formats. The total number of hot-key entries defined by both methods cannot exceed 16.