Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Keypad Entry
#6
Quote:I am working on a project that requires keypad entry.

Are you looking for ASCII input (with NumLock on), or navigation key input (with NumLock off)?

Either version of your test program should return proper ASCII values for the digit keys if NumLock is on.


I modified your second tester to print only the raw data that it sees, and also to print that data to a text file "k2out.txt":

Code: (Select All)
Rem Keypad-5 = 76
Rem Shift-Keypad-5 = 53
Rem Ctrl-Keypad-5 = 143

Open "o", 1, "k2out.txt"

Do
    X = _KeyHit
    If X Then
        Print "Keypress="; X; "("; (X And &HFF00) / 256; ")"
        Print #1, "Keypress="; X; "("; (X And &HFF00) / 256; ")"
        If X = 27 Then End
    End If
Loop

Close

End

and....

Each key sends a "make" code when pressed (or held down), and a "break" code when released, except for numpad-5....

With NumLock on, each key (including numpad-5) sends the appropriate ASCII value when the key is pressed or held down.  It sends a sign-flipped ASCII value when the key is released.

With NumLock off, each key sends a "make" code when the key is pressed (these will also repeat if held down), and also a "break" code when released, EXCEPT for numpad-5, which has no alternate non-numeric function.  Numpad-5 sends nothing when pressed or held, and only a single, non-repeating "break" code when the key is released.


Below are tables of the keycodes my modified tester sees.
The first table is the result of pressing & releasing the numpad keys 4, 5, & 6 with NumLock on.
The second table is the result of pressing & releasing the numpad keys 4, 5, & 6 with NumLock off.


With NumLock on:
4:  Keypress= 52 ( 0 )
    Keypress=-52 (-1 )

5:  Keypress= 53 ( 0 )
    Keypress=-53 (-1 )

6:  Keypress= 54 ( 0 )
    Keypress=-54 (-1 )

ESC: Keypress= 27 ( 0 )


==============================
==============================
==============================


With NumLock off:
4:  Keypress= 19200 ( 75 )
    Keypress=-19200 (-75 )

5:                                       (NOTE: no "make" code is sent when NumLock is off)
    Keypress=-12 (-1 )

6:  Keypress= 19712 ( 77 )
    Keypress=-19712 (-77 )

ESC: Keypress= 27 ( 0 )
Reply


Messages In This Thread
Keypad Entry - by eoredson - 01-07-2023, 05:33 AM
RE: Keypad Entry - by mnrvovrfc - 01-07-2023, 06:22 AM
RE: Keypad Entry - by eoredson - 01-08-2023, 10:55 PM
RE: Keypad Entry - by bplus - 01-09-2023, 02:27 AM
RE: Keypad Entry - by SMcNeill - 01-09-2023, 03:05 AM
RE: Keypad Entry - by JRace - 01-09-2023, 03:37 AM
RE: Keypad Entry - by eoredson - 01-09-2023, 03:48 AM
RE: Keypad Entry - by JRace - 01-09-2023, 04:04 AM
RE: Keypad Entry - by mnrvovrfc - 01-09-2023, 03:54 AM
RE: Keypad Entry - by TerryRitchie - 01-09-2023, 04:08 AM
RE: Keypad Entry - by SMcNeill - 01-09-2023, 04:10 AM
RE: Keypad Entry - by SMcNeill - 01-09-2023, 04:11 AM
RE: Keypad Entry - by JRace - 01-09-2023, 04:17 AM
RE: Keypad Entry - by SMcNeill - 01-09-2023, 04:20 AM
RE: Keypad Entry - by eoredson - 01-09-2023, 04:18 AM
RE: Keypad Entry - by SMcNeill - 01-09-2023, 04:26 AM
RE: Keypad Entry - by eoredson - 01-09-2023, 04:38 AM
RE: Keypad Entry - by SMcNeill - 01-09-2023, 04:53 AM



Users browsing this thread: 3 Guest(s)