How to Associate a Function Key to a Button


This article tells you how to associate a function key with a button so that it executes the same code whether you press the function key or click on the button.


Once a push button is defined, it is necessary to associate the appropriate code with the button so that when a function key (such as F7) is pressed, or when a mouse clicks on the push button, the proper response results.


Associating the exception value of the function key to be used with the push button enables the proper response when the key or button is pressed. For example, the value to associate with F1 is "1", and for F2 is "2", and so on.

When using AcuBench, you make this association by modifying the exception value property for the button.  If you are not using the AcuBench IDE, you'll need to add the following code (with "7" representing a value) to the button definition:


Here's an AcuBench code example resulting in the same response:

03 Screen1-Pb-F7, Push-Button,
              COL 25.90, LINE 22.40, LINES 2.80 CELLS, SIZE 6.10 CELLS,
              EXCEPTION-VALUE 7, ID IS 3, TITLE "F7".

The code to execute should be associated to the Link-To procedure of the push button. This code will execute whenever F7 is pressed or the push button is clicked.

You can find more information on this subject in your AcuBench User's Guide, Chapter "Working with Screens."

Old KB# 14350
Comment List