Topic Author
Posts: 188
Joined: 10 Mar 2015, 05:29

TextBox not working on Android

01 Oct 2016, 05:02

The TextBox cursor always goes in front when typing in Android. Has anyone else noticed this issue? Does it work for someone else? I wonder if there's a way to work around.

Also, when I tap in the middle of the text and type, the whole text is deleted instead of character inserted.

I opened a bug with repro.
User avatar
Site Admin
Posts: 2991
Joined: 22 Dec 2011, 19:20

Re: TextBox not working on Android

05 Oct 2016, 19:05


I already answered the bug ticket, but I want to share the answer here because it is useful to know.

When a Noesis TextBox gets the focus, we call UnityEngine.TouchScreenKeyboard.Open() to show the virtual keyboard.

The problem is that Unity that doesn't provide any info about the caret position in the virtual keyboard and it isn't possible either to change caret position in the virtual keyboard via code. So we are unable to update Noesis TextBox caret position.

One thing we can do to improve the current UI experience is to update cursor position to the end of text when it gets updated. While we fix this, you can go to SoftwareKeyboardManager.cs (under Assets/Plugins/NoesisGUI/Scripts/Core) and add in the OnUpdateText() function the following after text property is updated:
_textBox.CaretIndex = _keyboard.text.Length;
Anyway, once virtual keyboard gets opened, user should interact with the virtual keyboard to select text, change caret position, etc. Because the text that is written in the virtual keyboard is used to update the TextBox everytime it changes. This is why I think we should totally hide the Noesis caret, as it won't be always valid compared to the virtual keyboard's caret position.

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot], kaijin and 0 guests