Home The Company Publications Products Links Tips

Tips, Tricks, and Techniques

Last update: 30 April 2004

Save PF-Keys


Question

Is there any way to save the current value of a function key at the beginning of a HELP routine so as to restore them before returning to the application ?

Answer

have an A4 field to hold the value of the PF-KEY
#HOLD-KEY  := *PF-KEY
when you have returned from the sub-program
DECIDE ON FIRST VALUE #HOLD-KEY
  VALUE 'ENTR'
        SET CONTROL 'K0'
  VALUE 'PF1'
        SET CONTROL 'K1'
   VALUE 'PF2'
         SET CONTROL 'K2'
* etc. etc.

or you can redefine the hold-key, then compress 'K' and the last to characters into another field and then 'SET CONTROL field-name'. This however will not work for the ENTER key.

In most cases (especially when you are using help) you know the value of the PF-KEY used to invoke help (normally PF1) so you can just issue a SET CONTROL 'K1' statement as the last statement in the help-routine.

*PF-KEY holds the value of the last pf key pressed. Save it off to a local variable.

At the end of the program, you can use 'SET CONTROL' to simulate pressing a pf key.

Or just pass and return the variable you saved off to.

Top Page


Back to NATURAL Tips, Tricks, Techniques -- Overview