Remove Focus from a Control?

0 favourites
  • 5 posts
  • Right now I have a textbox and a button on a UI layer in a simple test project. I also have a keyboard event for right arrow released.

    The problem is once I click on the button or inside the textbox it now has focus and the keyboard input is sent to it instead of the rest of the game stopping my keyboard event from ever happening.

    So my question is how can I remove the focus from a control like that? Can I at all or is this a bug/missing option?

  • Possible to replace the button with a sprite? This wouldn't remove the focus from the game and it can look and with a few events behave like a button..

  • thatd work for a button but what about editing and interacting with the text in a textbox?

  • Hi I was trying to figure this out for a couple of days as well. It was a pain because I was working with the ipad, and the keyboard wouldn't go away after hitting enter.

    There's another thread which uses the CallJS plugin to lose focus:

    scirra.com/forum/making-a-textbox-lose-focus_topic51798.html

    It didn't work for me unfortunately, but I found a cheap-ish workaround.

    Once I filled my textbox, and pressed enter, I captured the data in a variable and destroyed the textbox, which immediately removed focus.

    Next in the same condition, I recreated the textbox in the same position, and repopulated it with the text.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It didn't work for me unfortunately, but I found a cheap-ish workaround.

    Once I filled my textbox, and pressed enter, I captured the data in a variable and destroyed the textbox, which immediately removed focus.

    Next in the same condition, I recreated the textbox in the same position, and repopulated it with the text.

    Very clever indeed, I will try that tonight, did you capture the return using the Keyboard/onkeypressed event?

    Thank You

    TC

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