Character windows - menusΒΆ

Menus


Main menu bar

All the labels must fit in a single line or the program cannot be run. The menuline clause can be used in the main menu bar to right justify labels or to achieve more complex spacing.

Submenus

The programmer must ensure that the window height is sufficient to open each submenu, or the program cannot be run.

Hotkeys

It is not necessary to press the ALT key in addition to the hotkey character.


Extra properties


palette = integer

The default palette for dropdown menus is the parent window palette. The palette= clause can be used to override this. PAL_DROP_MENU (12) may be used explicitly as an alternative.

The following pens from the menu palette are used for menu display:

PEN_NORMAL (21)

Used for normal display of a menu label.

PEN_BOLD (22)

Used to display the hotkey character in the menu label.

PEN_REVERSE (23)

Used to display the highlighted option.

PEN_BOLD_REVERSE (24)

Used to display the hotkey character in the highlighted option.

Default: The parent window palette.

See Palettes.

label_pen = integer

Pen for item label. Optional; if specified, over-rides the default, which is PEN_NORMAL (21). See Menu labels.


Menu label

Label lengths are subject to the following restrictions:

Main menu items

The combined labels on the main menu bar must fit within the window size, allowing for one blank column at the beginning and end, and for two spaces to appear between each label.

Subitems

A subitem label must not be so long that the submenu cannot be fitted entirely within the window. The maximum possible label width is (width of window) -3.

Note also that if no hotkey is specified in the label text, the first character of the label is used.


Menu item style flags

The WS_BULLET flag has no effect under character windows, where the indicator is always an asterisk. See Menu and menu item style flags.


The menuline clause

The menuline clause may be used in the main menu bar.

The normal layout of top level items is left justified within the menu bar, with two spaces separating each label. These two spaces are always retained between any items not separated by a menuline clause. If a single menuline clause is inserted before the first item, the entire label list is right justified within the menu bar, retaining the two-space gap between labels.

If a single menuline clause appears between items, the labels before the clause are left justified and subsequent clauses right justified.

If more than one menuline clause appears, the space available on the menu bar is equally divided, and the resulting portions of space displayed wherever a menuline clause appears. Consecutive menuline clauses may be used to increase the space between two items.

If the maximum menu bar total label length has already been reached, a menuline clause is ignored.


Menu item check clause

Both top-level and submenu options are visibly checked. Checked options are marked by an asterisk. See Menu item check clause.


Ring menus

The option line of a ring menu is displayed in the standard Sculptor predefined window winopt. The size of this window when created is determined by the length of the option list. It is by default positioned centred near the bottom of the screen. It may be declared in the program, and its properties (including its position) may be changed. The winopt window closes while an option is being processed, and re-opens as soon as control returns to the option menu.

It is not possible to position other window objects on the option line.

The effect of a hotkey is dependent on the value of the Sculptor system variable sys.MenuCR.

The default palette for ring menus is the task window palette. The border and shadow style are defined in the terminal parameter file, Section 11 (Palette Defaults), at sub-entry 7 of the entry corresponding to the menu palette number.

The following pens from the menu palette are used for the display of option line data:

PEN_NORMAL (21)

Used for normal display of option description text.

PEN_BOLD (22)

Used to display the hotkey character in the option description.

PEN_REVERSE (23)

Used to display the highlighted option.

PEN_BOLD_REVERSE (24)

Used to display the hotkey character in the highlighted option.

A ring menu is assigned a border and shadow style in the terminal parameter file, Section 11 (Palette Defaults). The border and shadow styles in use can be found at sub-entry 7 of the entry corresponding to the menu palette number. The sub-entry consists of two integers, which refer to the border and shadow styles bearing those numbers in Section 10 (Window Styling) of the terminal parameter file.

Hidden options


A menu item can be concealed from the user by prefixing it with an asterisk. The item does not appear in the option line on the screen, but can be selected by typing the asterisk followed by the option_id. Thus, the hidden option:

**d = "delete"

is selected by entering *d at the option line. If sys.MenuCRis ON, the option is now activated; if OFF, the RETURN key must also be pressed.

This type of option cannot be assigned a hotkey.


RELATED TOPICS

Character windows

Terminal parameter files