TextBox not working on Android
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.
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.
-
-
sfernandez
Site Admin
- Posts: 3197
- Joined:
Re: TextBox not working on Android
Hi,
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:
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.
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:
Code: Select all
_textBox.CaretIndex = _keyboard.text.Length;