Highlighted
Absent Member.
Absent Member.
368 views

[archive] Ascii retrieval

[Migrated content. Thread originally posted on 22 February 2008]

My apologies for this basic question, how do I retrieve the ascii character representation for user input? - ie, I code a screen with EF's that have an exception procedure - if the user hits the backspace an exception is generated but the key-status is 96, same thing with listboxes, if I hit the down arrow key an exception is generated but key-status is 96.
0 Likes
4 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] Ascii retrieval

Exception 96 is an event occured. If you want to have certain keys terminate the accept, you should declared them as exception keys.
Like for instance this will cause pressing the escape key terminate the accept with the value 27:

       77  KEY-STATUS IS SPECIAL-NAMES CRT STATUS PIC 9(5) VALUE 0.
           88 ESCAPE-KEY            VALUE 27.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Ascii retrieval

Thanks for the reply. The problem I am having is making the key-status return the ascii value of the user pressed key and generate an exception at the same time. For example - I have an entry field and want to determine when the user presses the backspace key. A NTF-CHANGED exception is set up for the EF but when the user presses backspace the key-status generated is an event-occurred 88 of key-status (96). I dont think I should have to re-map the backspace key but Setting up the SET ENVIRONMENT "KEYSTROKE" TO "EDIT=Backspace EXCEPTION=8 ^H" does not have an effect even when I include the special-names CRT STATUS declaration value 8. I need to have a way to programmatically determine what key the user has pressed - primarily for backspace but also for some other keys, this is why I want to get the ASCII value of the key pressed. (?):confused:
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Ascii retrieval

I should have said "making the key-status EQUAL to the ascii value"
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Ascii retrieval

It occurs that the NTF-CHANGED event only returns the current cursor position. If you want to have the keystroke from an entry field, you will have to use an ActiveX control, for instance the Microsoft Masked Edit control. Which is an entry field, and will give you control of the keystrokes.

I would consider this a good idea though, so I suggest you tell tech support to raise an enhancement request that the NTF-CHANGED event also return the key code.
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.