Highlighted
Absent Member.
Absent Member.
470 views

[archive] Testing Function Keys

[Migrated content. Thread originally posted on 16 February 2006]

How do I test if a function key (F1-F8) has been pressed?

Tia


Ian Warner
0 Likes
2 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] Testing Function Keys

Hi Ian,
declare:

* in an non gui env:
01 fun pic s9(005) comp-1.
88 f1 value 1.
88 f2 value 2.
88 f3 value 3.
88 f4 value 4.
88 f5 value 5.
88 f6 value 6.
88 f7 value 7.
88 f8 value 8.
* in an gui env:
01 fun pic s9(005) comp-1
is special-names crt status.
88 f1 value 1.
88 f2 value 2.
88 f3 value 3.
88 f4 value 4.
88 f5 value 5.
88 f6 value 6.
88 f7 value 7.
88 f8 value 8.

...
* in an non gui env:
accept myfield on exception fun continue
end-accept
if (f1)
perform do-f1
end-if
...
* in gui env:
accept handle-myfield on exception continue
end-accept
if (f1)
perform do-f1
end-if
*
NOTE: be careful if exception value if you set something like
KEYSTROKE ...
in cblconfi config file. (refer to documentation)
hope this helps, bye Giovanni
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Testing Function Keys

Actually, the CRT STATUS special names code works in both a gui and a non-gui environment. At least it does here.

We use the same variable, defined the same way in both our GUI and our text-based programs.

And it doesn't matter which format of the ACCEPT you use.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.