Ring menus

In the ring menu style the menu options appear in a single line at the top of the screen.

Any statement whose first non-space character is an asterisk (*) is a menu option of this type. This method cannot be used to specify individual menu options for different windows, but only to display one all-purpose menu. The menu is permanent, in that options cannot be added, removed, enabled or disabled at run time.

Despite its comparative lack of flexibility, this menu style can be preferable in some situations, such as testing, since it is faster to code.

The ring menu and drop menu styles may not be mixed within a single program.


Defining a ring menu option

SYNTAX


*[*]option_id = “description” [, “caption”]
     statements
     end

*[*]option_id

The option identifier. The option_id consists of one or two printable characters. Its only use is in the command:

on key_no optmenu *option_id

which configures a function key to select a ring menu option.

description

The description is the text which describes the option, briefly summarising its function. This description is what actually appears in the option line on the screen. A character in the text that is preceded by an ampersand (&) is the hotkey for the option. The ampersand is not displayed, but causes the character following it to be highlighted. Pressing this character selects the option immediately.

In order to display an ampersand within the description, use the form “&&”. i.e. to display “Marks & Spencer”, use “Marks && Spencer”. The ampersand does not become the hotkey

[, “caption”]

A help message to appear if menu captions are being displayed. See Captions.

statements

The Sculptor commands to be executed when the option is selected.

end

This statement terminates the option and returns program control to the menu.


Note

Ring menu options must appear in the main program code. They cannot be part of a function.


EXAMPLE

*n = "&NEXT", "Display the next record"

Option processing and termination

Following the option declaration are the Sculptor statements to be executed when the option is selected by the operator. The processing of an option continues until one of the following conditions occurs:

1

An end statement is encountered. This statement should be used to terminate an option. Control returns to the menu.

2

An exit statement is encountered. This statement terminates the program.

3

An untrapped error condition occurs. A relevant message is displayed and control returns to the menu.

4

The operator cancels the option during an input operation by pressing the CANCEL key, as defined in the terminal parameter file. This is only enabled if the Sculptor system variable sys.Cancel is ON (which it is by default).

Falling into an option

If the code for a menu option is not terminated with an end statement, then control simply falls through to the first statement of the next option. Therefore, unless such continuation is intended, care should be taken to include an end statement at the conclusion of each menu option. In addition, programs frequently contain initialisation statements which appear before the coding of individual menu options. These must be terminated by an end statement, or program control falls through into the first menu option. If there are no initialisation statements, an end is not required before the first menu option.


Operating a ring menu

When the program first loads, the first option in the list is highlighted. Options may then be selected by control keys, by hotkey, by accelerator key or with a mouse.

Control keys

Use the LEFT ARROW and RIGHT ARROW keys to change the highlighted option. The highlighted option is selected by pressing RETURN.

Hotkey

Options may also be selected by typing the hotkey character defined for the option. Hotkeys are assigned by preceding the required character in the option description with the ampersand character (&). This character stands out in the display. Pressing ALT plus the hotkey character causes the option to gain focus immediately, and selects it.

Hotkeys are not case dependent.

Mouse

A ring menu option is selected simply by a single left-click on the option.

Function key

The on command is used to assign a function key to call an option of this type.


RELATED TOPICS

Menus