EditableTextBox - Can't set keyboard focus

Hi,

If you clear the text after a commit you can’t give back the keyboard focus.

Repro:

  • Create a UI Widget
  • Add a EditableTextBx
  • Put the widget on the screen and set cursor “on”
  • In the widget, OnTextCommited event, for ECommit Enter, set the textbox text to “empty” and set Keyboard focus

You will see that you loose focus on commit and you can’t have it back unless you click on the TextBox.

Feature Request: In the slate implementation, you can say if the keyboard focus is lost or not on commit, but on the UMG widget, you don’t have acces to it.It could be useful to add this option.

Hello,

I was unable to reproduce this issue on our end. I have included an example of the setup that was used. I have a few questions for you that will help narrow down what issue it is that you are experiencing.

Example:

Quick questions:

  1. Can you reproduce this issue in a clean project?
  2. Could you provide screen shots of any blueprints or code that may be involved with this issue?

Hi,

Thanks for the sample, I will test that.

1 - Yes I repro this on a clean project.
2 - Will do by the end of week

In fact, if I remembered properly, in my test I set the Keyboard Focus after the SetText and not before as you did. In Theory, that should not matter but it seems to :smiley:

I will try to get back to you shortly on my test, but if in the mean time you have a few minutes to invert your 2 nodes and try the Set Focus after the SetText, we will save some time.

Thanks

I went ahead a swapped the nodes around and did not encounter the issue described above.

Thanks for the testing.
I will upload my ProjectFile with the issue so it will be easier to debug on your side.

Hi,

Here is my setup.

In fact, without testing the Commit type I don’t have the issue. If I’m testing the commit type I don’t have it.

could you please confirm you are facing this?

The issue is due t the fact that clearing the text raise the commit another time (Clear = commit, it’s a choice but not easy to anticipate).
So I have to set my focus on the On Cleared to get it working.

So can you considerer my Feature Request (see 1st post) as important as it solved those kind of issue.
It’s handle in the native slate widget but the property has not been implemented in the UMG Version or I don’t know where.

Thanks,

I have written up a feature request (UE-22748) and I have submitted it to the developers for further consideration. I will provide updates with any pertinent information as it becomes available. Thank you for your time and information.

Make it a great day

Hey,
I’m having the exact same problem as you. After I set the keyboard focus I print “has keyboard focus” and it shows “true” - but it doesn’t have the keyboard focus. I used your method of setting it after “cleared” and it worked. Thanks!

Hi Rudy,
I don’t know if this has had any attention here but I have some further information. After some testing I managed to get this to work as intended; all I had to do was add a 0.01 second delay node between the clear and set keyboard focus node. I think there may be an issue with the execution order or something along those lines here, but for now this is a ‘temporary’ fix.

After some testing I managed to get this to work as intended; all I had to do was add a 0.01 second delay node between the clear and set keyboard focus node. I think there may be an issue with the execution order or something along those lines here, but for now this is a ‘temporary’ fix.

http://puu.sh/rgzFn/24001e1469.png

On construct of my ’ load game’ UI i want the text to get the focus. When putting the set keyboard focus node right after the ’ on construct’ it doesn’t work. It does work when i add a delay node inbetween strangely enough. There is probably something else taking over the focus by default.

I think you can mark UE-22748 as resolved. I have this option in 4.16.

The way I got it to work for me was to ‘Set Input Mode UI only’ then, ‘set keyboard focus’ then ‘SetText’ .
Immediately after this I ‘Set Input Mode Game and UI’. Which is what it is set to usually in my game.

It seems, for me at least, that the Input Mode being ‘UI only’ at the time of setting focus is the important thing.
Maybe the delay used by noms above works because he has worked himself a little window where the Mode is ‘UI only’ before it is changed to ‘Game and UI’.

version 4.15.1 of engine.
cheers
Podge.

Figured out how to do it without the delay. I think someone said a clear triggers a commit. I was clearing my text box after handling the text on enter. So I just set focus on false. See the pic.