SetKeyboardFocus not working in 4.18

The SetKeyboardFocus functions seems not work in 4.18.
I created a widget with a text box. when I tap it, the keyboard shows up, but when I commit the text it goes alway. The commit lose focus option was disabled already. I tried to create a function to regain focus in the text box so the keyboard would be always visible but it’s not working. Also tried in a new blank project.

Tried applying delays, User Focus, Set UI mode only. nothing worked :confused:
It was working fine in 4.16

Hello brunogbrito,

I will be glad to look into this for you.

Please provide the new project that you created to try this in so I can take a look at it.

Thanks,
Tyler

Here it goes, check the level blueprint. What ever you try to use the SetKeyboardFocus it doesn’t show up. It only shows in the screen if I tap the text box.

You can download the project here: Dropbox - File Deleted

Hello,

Ok, I have been able to reproduce the issue you are describing, but I am unable to get it to work in 4.16 either. Can you elaborate on how you had it working in 4.16?

Thanks,
Tyler

Hello Tyler,

First, I would like to thank you for your attention on this matter.

Maybe if I elaborate more what my needs are you can help me out:

What I’m trying to do is to show the mobile keyboard on the screen without having to tap the text box, and leave it there even if the text is commited or if the user clicks in other UMG buttons. In 4.16 I was able to manage that checking if the textbox keyboard focus was true all the time, if it loses the focus it would bring it back by setting the focus on it again. (It’s not the best way but it was working before).

Could you maybe explain a better approach for this solution. I wish there was a function like: ShowVirtualKeyboard with a boolean so you could chose to bring the keyboard in or out (like Set Visibility) instead tapping the text box.

I found this documentation but I have no clue how to setup this on c++ or blueprints:

Thanks, Bruno

Hello,

Are you developing this for Android or iOS?

Thanks,
Tyler

Hello Tyler,

Android

Thanks Bruno

API 19
using the latest sdk
compiling with gradle

I was able to reproduce the right function in 4.16, Pasted the project files below:

Check the Level blueprint, after 5 seconds the mobile keyboard will show up.

Hello Tyler,

Complementing the previous post here goes the same project on 4.18, keyboard wont show up when you set the focus on it. Check the Level Blueprint.
ps: you will need to make an Android mobile package and install in your phone to reproduce this error since PC doesn’t have a virtual keyboard.

I’m sorry the long delay, got busy with work those last days :confused:

Hello,

Thanks for your patience as I looked into this issue for you.

The issue here is that just because the text box has focus, this doesn’t necessarily mean that Android is going to launch the virtual keyboard. I am not exactly sure why the method you were using in 4.16 worked, but that is not how this should be implemented.

From my research, there are two ways that you can do this. The most effective way would be to just build your own virtual keyboard as part of your UI. This will allow you complete control over when and where it displays, as well as how it will interact with the rest of your game.

The other option would be to tell Android to always show the virtual keyboard. This needs to be done using Java, and I found some information on doing this here: (Solution 3)

http://sterl.org/2016/02/android-show-keyboard-by-default/

My recommendation would be to build a virtual keyboard as part of your UI, as this would be the cleanest way to implement what you are trying to do.

Thanks,
Tyler

Hello Tyler,

Thanks for your reply. The problem in creating my own custom virtual keyboard as part of our UI is that the game has multi-languages, we are using an API capable to deal with 82 different languages. So each most of them has its own keyboard configuration and special characters. I will take a look in the java solution instead, but in advance do you know where specifically should I tweak that in my project file or engine source?

I would appreciate if you could request to Chris Babcock to implement a ShowVirtualKeyboard funtion exposed in blueprints in a future update. I tried to build myself but I’m still not capable to construct it c++ :wink:

Thank you for your time and attention once again

I use SetText(" ") before SetKeyboardFocus to solve this problem.

Didn’t work for me :confused:
I’m on 4.18 btw