Controlling Input Focus

Get help using Construct 2

Post » Wed Mar 11, 2015 9:36 pm

Hello all.

Is there a way I can check/manually set the input focus on a specific element, i.e. a text box, so that I may control tabbing between different elements?

Thanks.
B
3
Posts: 3
Reputation: 181

Post » Wed Mar 11, 2015 10:00 pm

Code: Select all
TextBox -> Set Focused

but there is no ways to check is control in focus or not, you need to make it manually with some var
B
8
Posts: 72
Reputation: 456

Post » Wed Mar 11, 2015 10:28 pm

@Ashley not hard to check the focus of an element in Javascript, could it not be added?
Nothing goes unanswered!
B
22
S
5
G
1
Posts: 430
Reputation: 3,383

Post » Wed Mar 11, 2015 10:44 pm

Thanks for the replies, though I didn't stop to think about overriding the default browser tabbing. Is there an easy way to do this from within Construct 2's event sheet, or is this something I'd have to right a plugin or external JavaScript for?

My logic is currently something like this, and it appears as though the built-in browser tabbing is interfering with this:

On key code 9 pressed
----if text0 has focus, set text1 focus
----else if text1 has focus, set text0 focus
B
3
Posts: 3
Reputation: 181

Post » Wed Mar 11, 2015 11:48 pm

It is possible with just the browser object. See the attached capx. Take note that the text boxes have their id set to 'text1' and 'text2' which allows them to be referenced by javascript outside the game.
You do not have the required permissions to view the files attached to this post.
Nothing goes unanswered!
B
22
S
5
G
1
Posts: 430
Reputation: 3,383


Return to How do I....?

Who is online

Users browsing this forum: rap3dgp and 33 guests