Help Screens in AMT-COBOL
In AMT-COBOL there are two different ways to display a help screen to the end-user.
Static Help Screens
The first way is to use the 'Help Screens' node of the form.
These screens are called by pressing the 'F1' button on runtime.
Depending on the defined help screens on a form, one of the following actions will happen after pressing 'F1' on runtime:
- If there is a single help screen defined for a form, that screen will be displayed.
- When multiple help screens are defined for a form, the screen with an identical name to the layout control that currently has the focus will be displayed.
If the focused control has no corresponding help screen, an error message will be displayed stating that the help screen was not found for that control. - If there are no help screens defined, then 'PF1' will be sent to the COBOL business logic.
See 'Help Screens' for information on how to define the screens.
Dynamic Help Screens
The second way is to call a dynamically created help screen from a COBOL program using the following syntax:
CALL 'SHOWHELPSCREEN' USING '<Help Content>'.
Parameter | Description |
<Help Content> | A variable or literal containing the content of the help screen to be displayed, including optional HTML formatting. |
The help screen will then be displayed when returning to the same form. Switching to an other form will clear the help screen request.
Example:
working-storage section.
...
01 HELP-SCREEN.
03 HELPHTMLBEGIN PIC X(41) VALUE '<span style="color:blue;font-size:20px;">'.
03 HELPCONTROL PIC X(20).
03 HELP1 PIC X(25) VALUE '<br>is a control used to '.
03 HELPCONTROLFUNCTION PIC X(30).
03 HELP2 PIC X(29) VALUE '.<br>Located on the form:<br>'
03 HELPFORM PIC X(20).
03 HELPHTMLEND PIC X(7) VALUE '</span>'.
procedure division.
...
0900-display-help.
MOVE SI-FOCUSEDFIELD to HELPCONTROL.
MOVE 'move to the corresponding form' to HELPCONTROLFUNCTION.
MOVE SI-CURRFORM TO HELPFORM.
CALL 'SHOWHELPSCREEN' USING HELP-SCREEN.
GO TO 0400-return-form.