Keypress event is triggered twice for a single ENTER button press in Windows CE

亡梦爱人 提交于 2020-01-06 07:25:08

问题


During development i have observed that certain PDAs with Windows CE and possibly Windows Mobile too are sending the Enter key twice in the key pressed event thus i execute twice the code that lies under the control's key press event for the return button.

I suspect that this is a hardware bug and i would like to ask how you resolved it without changing your application logic.


回答1:


Without changing the logic? You really can't (unless there is a hardware or firmware fix). I'd guess the simplest mechanism (that requires a logic change) is to treat two Enter keys or keypresses in a short period (say < 100ms) then ignore the second.




回答2:


I don’t know if this will help but if you read the keyboard port Enter is seen as two bytes rather than one.




回答3:


This happened to me too and it turned out it was because the "enable character repeat" option was enabled in control panel->keyboard. The default repeat delay was way too fast for the keypad that we used, so I just slowed it down and the problem went away.



来源:https://stackoverflow.com/questions/634230/keypress-event-is-triggered-twice-for-a-single-enter-button-press-in-windows-ce

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!