Announcement

Collapse
No announcement yet.

How to register ESC or Tab when widget text box has keyboard focus?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to register ESC or Tab when widget text box has keyboard focus?

    Hello all!

    I am building a chat box in a multiplayer project. I want to make it so after typing and sending your message, pressing ESC refocuses to game. (and eventually pressing TAB to switch between all chat and team chat.)

    I can't figure out how to detect ESC or Tab input when text box has keyboard focus.

    Here's my setup:
    In event begin play, I'm setting input mode to game only:
    Click image for larger version  Name:	eventbeginplay.PNG Views:	1 Size:	47.9 KB ID:	1615994
    Then, by pressing T, it focuses to chat text box, so I can immediately start typing a message without having to click the text box with my mouse:
    Click image for larger version  Name:	Set-focus.PNG Views:	1 Size:	142.6 KB ID:	1615995
    Then, here's what ESC is bound to do in player controller:
    Click image for larger version  Name:	what-esc-do.PNG Views:	1 Size:	91.7 KB ID:	1615996
    I have this debug print string setup on event tick to monitor what the widget has in focus:
    Click image for larger version  Name:	Focus-check.PNG Views:	1 Size:	147.6 KB ID:	1615997
    Here's what my results are:

    Right as I go in game, where I can control my player:
    Any user focus: false/ Has user focus: false/ Keyboard focus: false

    Pressing T once, where I can now type a message:
    Any user focus: false/ Has user focus: false/ Keyboard focus: true

    Pressing ESC once, now I'm stuck in some weird interface mode where WASD registers my character movement input, but my mouse is free to move around, and if I want to look around as player, I have to right click drag the screen (I'm using third person BP template). I can use my mouse to click the textbox to focus back on it.
    Any user focus: true/ Has user focus: true/ Keyboard focus: true

    Pressing ESC twice, does my intended effect, bringing me back to game only input.
    Any user focus: false/ Has user focus: false/ Keyboard focus: false

    This tells me somewhere is consuming my ESC input (and Tab input) before my player controller can handle it. Anyone know where and how I can modify it to do what I want?

    Thank you!
    Last edited by crystal6tak; 05-06-2019, 09:52 AM.
Working...
X