ContentsIndexPreviousNext

8.12 Menu Configuration With the Generic Menu Handler

The ACUCOBOL-GT generic menu handler allows you to configure several aspects of its look and feel. This is done with get/set configuration operations described in the previous section. For both of these operations, you must pass a parameter that has the following layout:

01  MENU-CONFIGURATION.
    03  MENU-STYLE                             PIC 9 COMP-X.
        88  MENU-IS-STATIC                     VALUE 0.
        88  MENU-IS-POPUP                      VALUE 1.
    03  MENU-CHECK-MARK                        PIC X.
    03  MENU-SUBMENU-MARK                      PIC X.
    03  MENU-COLOR-ATTRIBUTES.
        05  MENU-NORMAL-COLOR-ATTRIBUTES.
            07  MENU-NORMAL-COLOR              PIC 9(4) COMP-X.
            07  MENU-NORMAL-COLOR-KEY-1        PIC 9(4) COMP-X.
            07  MENU-NORMAL-COLOR-KEY-2        PIC 9(4) COMP-X.
        05  MENU-SELECTED-COLOR-ATTRIBUTES.
            07  MENU-SELECTED-COLOR            PIC 9(4) COMP-X.
            07  MENU-SELECTED-COLOR-KEY-1      PIC 9(4) COMP-X.
            07  MENU-SELECTED-COLOR-KEY-2      PIC 9(4) COMP-X.
        05  MENU-DISABLED-COLOR-ATTRIBUTES.
            07  MENU-DISABLED-COLOR            PIC 9(4) COMP-X.
            07  MENU-DISABLED-COLOR-KEY-1      PIC 9(4) COMP-X.
            07  MENU-DISABLED-COLOR-KEY-2      PIC 9(4) COMP-X.
    03  MENU-MONO-ATTRIBUTES.
        05  MENU-NORMAL-MONO-ATTRIBUTES.
            07  MENU-NORMAL-MONO               PIC 9(4) COMP-X.
            07  MENU-NORMAL-MONO-KEY-1         PIC 9(4) COMP-X.
            07  MENU-NORMAL-MONO-KEY-2         PIC 9(4) COMP-X.
        05  MENU-SELECTED-MONO-ATTRIBUTES.
            07  MENU-SELECTED-MONO             PIC 9(4) COMP-X.
            07  MENU-SELECTED-MONO-KEY-1       PIC 9(4) COMP-X.
            07  MENU-SELECTED-MONO-KEY-2       PIC 9(4) COMP-X.
        05  MENU-DISABLED-MONO-ATTRIBUTES.
            07  MENU-DISABLED-MONO             PIC 9(4) COMP-X.
            07  MENU-DISABLED-MONO-KEY-1       PIC 9(4) COMP-X.
            07  MENU-DISABLED-MONO-KEY-2       PIC 9(4) COMP-X.

A copy of this data item can be found in "acugui.def".

When a menu is shown, the current configuration defines how it is presented. The fields have the following meaning:

MENU-STYLE Determines whether the menu is static (value 0) or pop-up (value 1). The default is static.

MENU-CHECK-MARK Sets the character used to mark an item, to indicate that it has been selected. The default character is an asterisk.

MENU-SUBMENU-MARK Sets the character used to indicate that the item is a submenu. This is not used on the main menu bar. The default character is a greater-than sign.

MENU-COLOR-ATTRIBUTES Defines the display attributes used if the station supports color. This is described in detail below.

MENU-MONO-ATTRIBUTES Defines the display attributes used if the station is monochrome. See below for details.


Note
that there are two sets of attributes, one for color stations and one for monochrome stations. Within each set, there are three group items that determine the attributes used for a particular case. Using color stations as an example, we have:
MENU-NORMAL-COLOR-ATTRIBUTES Determines the attributes used for the normal menu items. This is used for the menu's background color and all items that are not highlighted or disabled.

MENU-SELECTED-COLOR-ATTRIBUTES Determines the attributes used for the currently selected (highlighted) menu items.

MENU-DISABLED-COLOR-ATTRIBUTES Determines the attributes used by disabled menu items.

Finally, within each group, there are three fields that determine the attributes used for the appropriate menu items. For example, with normal menu items on a color station, we have:

MENU-NORMAL-COLOR This is the attribute used to draw the menu item and its background.

MENU-NORMAL-COLOR-KEY-1 This is the attribute used to draw the key letter in the menu item (if any).

MENU-NORMAL-COLOR-KEY-2 This is used only if MENU-NORMAL-COLOR-KEY-1 contains the underline attribute and the station does not support underlining. In this case, the actual attribute used is determined by this field.

This scheme of having two possible attributes available for the key letter makes it easier to implement a portable set of attributes. Traditionally, key letters are shown underlined, and so underlining is typically used in the "KEY-1" attribute. Since many stations do not support underlining, having a second attribute provides a backup system.

Attributes are set using the same scheme as that used for the COLOR phrase in an ACCEPT or DISPLAY statement. The only exception is that the "Protected" attribute (32768) has a special meaning when used in conjunction with disabled menu items. If you specify "protected" as the disabled item's color, then disabled items will appear in parentheses on the menu. This helps distinguish them from normal items.

Attribute values are numeric. They represent combinations of colors and other video features such as intensity. You make combinations by adding appropriate values together from these tables:

Color
Foreground
Background
Black
1
32
Blue
2
64
Green
3
96
Cyan
4
128
Red
5
160
Magenta
6
192
Brown
7
224
White
8
256

Attribute
Value
Reverse video
1024
Low intensity
2048
High intensity
4096
Underline
8192
Blink
16384
Protected
32768

The default settings for attributes are as follows:

COLOR DEFAULTS

Type
Main Attribute
Key-1 Attribute
Key-2 Attribute
Normal
Black on Cyan
(129)
Black on Cyan, Underlined (8321)
High-intensity White on Cyan (4232)

Selected
White on Blue
(72)
White on Blue, Underlined (8264)
High-intensity White on Blue (4168)

Disabled
White on Cyan
(136)
White on Cyan (136)
White on Cyan (136)

MONOCHROME DEFAULTS

Type
Main Attribute
Key-1 Attribute
Key-2 Attribute
Normal
Black on White
(257)
Black on White, Underlined (8449)
High-intensity Black on White (4353)

Selected
White on Black
(40)
White on Black, Underlined (8232)
High-intensity White on Black (4136)

Disabled
Black on White, Parenthesized
(32935)
Black on White (257)
Black on White (257)

The ACUCOBOL-GT debugger always uses the default configuration for its own menu bar.