Hi,
I’m working on a chat system. The idea is that when a player presses the chat button, the mouse cursor is hidden, a text box appears, the focus is set to UI Only and all that the player can do from there is input text into the text box. Once the text is committed, the text box is hidden again, and the focus is reverted to Game Only.
So, I’ve got a widget blueprint that contains a Canvas Panel and a Text Box as its child. Everything works fine until I press the ESC key, after which the text box loses focus. From what I understand, the focus is set to the Canvas Panel. To get the text box to focus again I have to press the TAB key.
I tried to fix the issue by adding a OnKeyDown override in the widget’s blueprint, which would return focus to the text box when the ESC key is pressed. But that only works when I press the ESC key twice.
From what I understand, what I’m getting is:
ESC Key (first press): Switch focus from Text Box to Canvas Panel.
ESC Key (second press): Switch focus to Player Controller and run whatever is in OnKeyDown.
I’m at my wit’s end, does anyone know what to do?