Hundreds of features to explore
Games made in Construct
Your questions answered
Trusted by schools and universities worldwide
Free education resources to use in the classroom
Students do not need accounts with us
What we believe
We are in this together
World class complete documentation
Official and community submitted guides
Learn and share with other game developers
Upload and play games from the Construct community
Game development stories & opinions
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.
Well I am trying to detect Shift Capslock and Ctrl.