UE4 window loses focus after committing UMG text box

I’m using this function on my character to control mouse capture. It’s not working very well.

My camera has suddenly become click and drag both in PIE and standalone. It shouldn’t be.


I’ve gotten further with an updated function:

The problem now is that the UE4 window loses focus after I commit on a text box. I have to click it again to regain focus. This seems like extremely bizarre behavior and I can’t quite understand why the engine should ever do that. Here’s what my text box commit event looks like:

I guess this is normal in this Input Mode. Either set it to UI only or disable the Camera Rotation for the time that your Mouse Cursor is visible.

Okay, I’ve gotten a bit further - updated the main question.

Not sure if you still need help with this one but in case anyone else dose here is what I did when I ran into this issue:

It seems that for some reason when you enter text and press Enter not only does the On Enter exec path fire but Default and On Cleared also fire. So, when On Cleared fires I perform a simple reset operation (which also happens to be the same one that the controller calls when beginning text entry).

This allows you to type a message, press Enter, type another message, press Enter

The behavior is a bit odd IMHO and isn’t documented very well but this works at least.

If I find this question then anyone could find these wrong answers (at least for 4.16).

The only thing you need is:

Look at this awesome answer! I’ll give you an orange

This is doing something different than what OP mentioned.
When you commit a value, the entire window loses focus, keybinds will not work.

This flag keeps the focus on the text input element.

The ideal behavior would be for the text box to lose focus but the focus to pass on to the window instead of being lost.

There still doesn’t seem to be a simple way to get that result.

Wow, this helped me a lot!! Thanks!