SOLVED How do I stop the tab key tabbing through html elements?

0 favourites
  • 8 posts
From the Asset Store
Random Maze Generator with Door & Key System - tutorial capx
  • I don't want that to happen. Is there a way to stop it?

    I tried adding: Set CSS Style "tabindex" to "-1" but that didn't have any effect

    I notice also that keyboard events aren't registered while a text input is focussed, so there seems to be no way I can do On Enter- un focus all text inputs..it just always automatically tabs to the next one when Enter or Tab is pressed.

    Thanks

  • "On Enter Pressed" still works for me when cursor is in a text input.

    To stop the Tab key to move focus to another text input you can try this code, but it only works with Worker disabled:

  • CHeers. Does On Enter pressed work though if you have multiple input boxes? For me it triggers only after it tabs out of the final input box.

  • "On Enter Pressed" still works for me when cursor is in a text input.

    To stop the Tab key to move focus to another text input you can try this code, but it only works with Worker disabled:

    Hi, for this code how exactly do I go about assigning/using the textInputID. I'm not sure how it works. Do I simply put a string "textInputID" into the ID parameter of each textinput object?

    Thanks

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • CHeers. Does On Enter pressed work though if you have multiple input boxes?

    Yes.

    Do I simply put a string "textInputID" into the ID parameter of each textinput object?

    Yeah, you have to give them unique IDs and call this code for each textinput. There are perhaps ways to optimize it, but I don't know JS.

  • HI, sorry for bothering but is this how the code and the input communicate with each other? I tried the following but the console log doesn't print anything when I press a key when the text input is focussed. Maybe Im doing it completely wrong?

  • "On Enter Pressed" still works for me when cursor is in a text input.

    This is on PC yes? Apologies, for this I am talking specifically about Android (I stupidly forgot to mention). When I hit enter it just tabs between text input and no reading is given for lastKeyPressed.

  • SOLVED.

    After lots of going round in circles the solution is very easy. The trick is to use:

    Set attribute "tabIndex" to "-1"

    and NOT:

    Set CSS style "tabIndex" to "-1"

    ..which is what I was doing initially. (oops)

    Thanks for all the help!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)