Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simulating sms style typing using keypress

Tags:

c#

keypress

Can anyone point me in the right direction to be able to simulate sms style typing using keypress on the number pad?

I can get each number to print out a letter but am unsure of how to get my program to treat a number of keypresses on the same key as the same 'event' (i.e. scrolling through several letters if the key is pressed again within a period of (for example) 2 seconds).

I have looked up multiple keypresses but always come up with key combinations (ctrl, alt, delete etc).

like image 334
Dylan Jackson Avatar asked Jun 02 '26 16:06

Dylan Jackson


1 Answers

You need a state-machine and count the number of presses on each key to determine the letter. Then pass these letters on (using events) to the rest of your app.

Ps. did you notice that the numbers on a numeric keypad are in a different order than on a phone? (789 are the top row on a keyboard and the bottom row on a phone)

like image 118
thijs Avatar answered Jun 05 '26 07:06

thijs



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!