Highlighted
Absent Member.
Absent Member.
879 views

Which key is pressed

[Migrated content. Thread originally posted on 01 March 2012]

Hi all 🙂

I would like a user to have the possibility to "break out" of a program execution by pressing the Escape key. I have the following code to determine if the user pressed the Escape key during the run:

ACCEPT KBD-INPUT-STATUS FROM INPUT STATUS.

IF KBD-INPUT-STATUS = ZERO
EXIT PARAGRAPH.

ACCEPT OMITTED
BEFORE TIME 0
WITH NO ADVANCING
ON EXCEPTION
ACCEPT KBD-HIT-KEY FROM ESCAPE.

Unfortunately the code halts if the user presses the space key.
Anyone have a better idea hos to dertermine if the user pressed the Escape key without having to hold the execution until a key is pressed ?

Thanks in advance.
Steen
0 Likes
2 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Which key is pressed

Have you tried

ACCEPT OMITTED
BEFORE TIME 0
WITH NO ADVANCING
ON ESCAPE
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Which key is pressed

Yes - that dosnt work.
For some reason the code after ON ESCAPE is executed even if I dont press any key ....?
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.