Disable InputText

Hi,

I’d like to block an InputText from being edited, is there a simple and clean way to do this ?
Right now I’m thinking of something like 'onTextChangedObservable' -> myInputText.text = savedText, but that’s not very graceful…

My situation is that I have a scene that serves as a form, using various interaction modes to receive inputs from the user (including an InputText on a mesh).
What I’d like to do is block the InputText when the user moves on to another “input station” (the InputText might still be visible depending on the canvas aspect ratio, so I would like not to simply hide/disable it).
And if the user wants to come back to the InputText, I can enable it again.

Does it make sens ?

Thanks !

If there is no clean way to do this I would set a transparent plane in front of the InputText…

That’s a solution, I would still need to make sure it loses the focus (my app requires to click a button to move to the next step, so I can assume to focus will have been lost at that point, but it’s sort of a lucky coincidence - I don’t like that in programming…).

https://doc.babylonjs.com/api/classes/babylon.gui.inputtext

isEnabled( … ) … sounds promising! :slight_smile:

Makes it disappear, so still not good :wink:

There is no out of the box way to do it (but we could add it if you want to send a PR) :slight_smile:

I’ll look into it, I’ll let you know (I guess all input controls could benefit of a ‘disableInput’ method).
I’m also quite interested in a multiline InputText, so I’ll follow with that post and see if I can slip my ‘disable’ option in the pot.
If not, I’ll have to spend some time learning TS and proper use of Git (I’m no programmer, just a savvy engineer).