Progress
Programming
Handbook
Telling Progress How to Continue Processing
When you modify a field or variable, pressing GO tells Progress to accept the data in all the modified fields and variables in the current statement and to go on to the next statement in the procedure.
As the following figure shows, if you press GO while the cursor is in the name, credit–limit, or sales–rep fields, Progress continues on to the next statement in the procedure, which is END. The procedure then returns to the beginning of the FOR EACH loop.
p-intro.p
![]()
You might want to define function keys that tell Progress to continue processing data a certain way. You can use the GO–ON phrase with the SET or UPDATE statement to do this, as shown in the following procedure:
In this example, if the user presses F8, F10, or F12 while updating the customer data, the procedure immediately goes on to the next statement in the procedure. Let’s take a closer look at this procedure.
Any key you can press while running a Progress procedure has a code, a function, and a label associated with it. The code of a key is an integer value that Progress uses to identify that key. For example, the code of F1 is 301. The function of a key is the work that Progress does when you press the key. For example, the function of the F1 key may be HELP. The label of a key is the actual label that appears on the keyboard key. The label of the F1 key is F1.
As shown earlier, you can use the KEYLABEL, KEYCODE, KEYFUNCTION, and KBLABEL functions to convert key labels, key codes, and key functions. In addition to these functions, the LASTKEY function returns the key code of the last key pressed.
You can use the functions described in this table to monitor the keys being pressed, as in this example:
Run procedure
p-keys.p
to see how the different keys you press translate into key codes, key labels, and key functions.Now, run the
p-gon1.p
procedure. You see a screen similar to the one shown in the following figure:Figure 6–4: The p-gon1.p Procedure
![]()
While updating the customer information, press F9, F10, F11, or use either of the standard techniques to signal the end of data entry, Progress goes on to the next statement in the procedure. If you press any other key, Progress does not continue on to the next statement in the procedure, but instead performs the data entry operation associated with that key. If you press END–ERROR, Progress performs the default ENDKEY processing of UNDO, LEAVE. See "Condition Handling and Messages," for more information on ENDKEY processing.
If Progress does continue on to the next statement in the procedure, the CASE statement determines the action to take by checking the value of the last key pressed.
The procedure
p-gon2.p
shows how you can achieve the same functionality in an event-driven application:
Use the ANYWHERE option of the ON statement to set up triggers that execute no matter which widget has input focus. In
p-gon2.p
, the ANYWHERE option is used to assign triggers to function keys.NOTE: In a larger program, you must be careful of the scope of the ANYWHERE trigger.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |