Question Regarding UMG


so I created a multiplayer chat system and all working well.

now I wanted to implement “Enter” to send the text instead of putting a new line or pressing a button to send the text.

could somebody help me figure this out, as most games , actually all games have this feature.

thank you.

One way of doing it is to override the “OnKeyDown” function in your widget.


In there you can check which button was pressed and then execute your logic. You hav eto make sure, that this widget is being focused though.

Another way would be to setup an input event in your player blueprint, which checks if the player is currently in the chatbox and if that is the case execute the send function in your widget

i’ll test that, even tho I think I tried this but without focus perhaps

Let me know if it worked

it didn’t even tho I checked focused on the WB and the HUD itself, works only when focus is cleared from the WB, for instance I type something and press enter it does nothing, but when I click on the screen (else where then the WB itself) it sends the text.

I couldn’t find a node other then Is Mouse Button Down.

enlighten me please :stuck_out_tongue_winking_eye:

ok I solved it, but in a very deferent method but it works the way It should.

You have to get the key from the “InKeyEvent” input :slight_smile:

I need a way to clear the focus from the WB, because when I enter and it sends the text , the text box still has the focus and I could keep typing

so that way I want this to function is, when the widget doesn’t have focus and I press enter, it will focus the text box, and if I press enter again it sends the text and clear the focus from the text box.

I cant find a note that “CLEARS” the focus from a widget, but I could make it focus on another widget instead