I am using a text input box and I want it to detect when a certain key is pressed. Any idea how to do this?
Develop games in your browser. Powerful, performant & highly capable.
When cursor is in the Text Input, you can only detect Enter and Escape keyboard events.
So it is impossible? Also, I don't think the cursor affects it. Only if it is focused.
When text changes in the text box, you can compare it with the previous text and figure out what key was pressed. But it may be tricky for Del/Backspace keys or when a character is added in the middle of the string.
Another option is to make your own text input box.
howtoconstructdemos.com/old-terminal-style-text-input-with-blinking-cursor-capx
Well I am trying to detect Shift Capslock and Ctrl.