Babylon.GUI focus

Is there a way to focus on a specific element of babylon.gui without clicking it? I’ve searched high and low for some type of inputText.focus() function to call on a keypress but am lost :frowning:

https://www.babylonjs-playground.com/#ZU3CGI#1

As an example, to type into the input box in this PG, we must click the box. Is there a call implemented for focusing upon keypress instead of clicking the box?

Hey!

Should be something like adt.focusedControl = ...

1 Like

@Deltakosh thank you for the speedy reply! I’ve found the focusedControl(), can I pass in the name of the inputText? (Not at dev machine currently on mobile)

Currently the name for input text in project is
inputText.name = “chatInput”
Or something along those lines,

So should I use
Adt.focusedControl = “chatInput” or, should I just call it as

Adt.focusedControl = CHAT.inputText; ?

You need to pass the control itself

Alright, thank you.

Also, while we’re here instead of making a new thread, is there a way to disable prompt() on mobile input text, to implement the virtual keyboard?

Sure just call: inputText.disableMobilePrompt = true (need the very latest version from master)

Thank you so much
@Deltakosh

1 Like