Key Events in Thunkable?

Hello.

How do you add a key event in Thunkable? Am trying to use the enter key but I don’t know the code… please resolve and comment below.

Thanks

2 Likes

There are no key events in Thunkable. I really wish there were.

@muneer has been helping me with javascript event handling to work with key presses. He might be able to share that code with you. I can also see if I have a demo that you can work from.

I don’t see key events as a feature request but you should definitely consider adding it!

1 Like

Like, for web apps? When would this come in handy?

1 Like

Yes, web apps. Wordle, for example. Or games with arrow key movement.

3 Likes

For text input components you can use the submit block which is basically the enter key.

But Text Inputs have all sorts of problems from not auto-focusing on screen load to… not auto-focusing on additional Text Inputs on the screen to… not registering additional clicks.

1 Like

Yes, this is true and I add to the list that text input does not have a block to disable it. If such a block is available then may be you can disable the block to force the focus to the next text input.

In case there is any interest in detecting key events, this is my demo project.
https://x.thunkable.com/projectPage/60f8072c65863b0012f776a2

Again, due to no auto focus or auto execute of Web Viewer codes, you will need to click on the image first to start the key listener. The listener is returning the key code which is the physical location of the key instead of the ASCII value so you do not have to worry about upper case/lower case

2 Likes

I’ve made a pull request (Add keyboard input · Issue #847 · thunkable/thunkable-issues · GitHub) a long time ago.
You can possibly contribute to the request to make it happen

2 Likes

Yeah, Wordle is a good one to use key events…

Yknow the text input? That uses keyboard events. TI could probably help…?

1 Like

Please read the other comments in this topic. I mentioned several problems with text inputs.

1 Like