Skip to main content

[archive] Ascii retrieval

  • February 25, 2008
  • 6 replies
  • 0 views

[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.

6 replies

[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.
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.

[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.
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.

[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.
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:

[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.
I should have said "making the key-status EQUAL to the ascii value"

[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.
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.

[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.
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.