Defining Function Key Logic [ HP ALLBASE/4GL Developer Self-Paced Training Guide ] MPE/iX 5.0 Documentation
HP ALLBASE/4GL Developer Self-Paced Training Guide
Defining Function Key Logic
Two functions called from the function keys allow the user to switch
between updating products and updating options. These functions are
called by the product_keys and option_keys function keys.
The logic and description of each function is provided below.
To create the option function:
This function allows the user to move to the option window when a valid
product record has been retrieved.
1. Create the option function, using the logic commands shown below.
2. Generate the function.
1 IF V-product_status <> C-record THEN MESSAGE
no_product; EXIT
2 IF V-mode = C-review THEN MESSAGE no_option_review; EXIT
3 MOVE C-option V-current_record
4 MOVE C-no_record V-option_status
5 FILE *BUFFER option
6 WINDOW option
7 MOVE "5" *FIELDNO
8 EXIT
The function operates as described below.
Line 1 Since options can only be accessed after a product
record has been retrieved, this step checks that a
product record is current. If there is no current
product record, it displays an error message and
then exits.
Line 2 In review mode, the options can only be reviewed by
using the Scroll Options function key. If the
current mode is review, this step displays a
warning message, and the function exits.
line 3 This step starts setting up for the option window.
It specifies that the current record type is now an
option record.
Line 4 An option record has not been accessed yet, so the
option_status variable is set to no_record.
Line 5 This step clears the option file buffer. Data may
otherwise remain in the option file buffer from a
previous update.
Line 6 This step displays the option window. The current
contents of the data screen from line 9 downwards
are cleared and the window is overlaid on the
screen from that line downwards.
Line 7 This step changes the value of the current field
number. The cursor moves to the option number
field, field number 5, on the screen when the
function finishes.
__________________________________________________
NOTE Since the function changes the value of
*FIELDNO, HP ALLBASE/4GL automatically
commits the current field when this function
finishes. If the user presses the Option
function key while the cursor is on the
product_no field, the product_key_read
function is executed as an after function.
__________________________________________________
Line 8 The function exits.
To create message for the function key:
The option function displays the no_option_review message. In review
mode, options can only be reviewed by pressing the Scroll Options
function key.
1. Create this message now.
Name no_option_review
Type WARN
Contents "Press the [Scroll Options] function key"
"to review options."
To create the product function:
This function allows the user to return to the product screen.
1. Create the product function, using the logic commands shown below.
2. Generate the function.
1 MOVE C-product V-current_record
2 ON 1
3 MOVE "1" *FIELDNO
4 EXIT
This function is very simple. The current record mode is first set to
product. The initial scroll indicator, user switch 1, is set to on.
This switch is tested in logic that you will create later, and on
indicates that no option has been read for the product.
Then the number of the product number screen field is moved to *FIELDNO.
The function then exits.
When the cursor moves to the first field of the screen the
product_key_read function on that field is performed in its prior state.
When you modify that function in the next chapter, you will see that it
clears the option window area by displaying the prod_wnd window.
MPE/iX 5.0 Documentation