UMG Chat?

Hi. I’m very new to UE4, and I’m using the latest version.

I started working on a simple third-person project, and I want to add a simple chat functionality. For this, I need the chat’s UI.

Using UMG, I was able to press Enter and make the UI visible. However, none of the input text boxes are automatically focused. I could not find how to focus an input box, after it comes visible.

How would I do that?

This is the simple BP to display the UMG when Enter is pressed. The UMG is just the 3 input text fields available. “Text Input UMG” is the UMG BP’s name.

Try calling SetKeyboardFocus on the text input widget.

For some reason that function is const/pure, shouldn’t be. Looks like you’ll need to make a utility C++ function that calls it for now, as the BP graph will treat it as a pure getter with no execution pin. Will be callable in 4.8.

I’m just working on that. One of your client widget is focused, but it stay on behind of others. In poor words the problem is that the event begin play for some reason is called several time. Look this.

As you can see for one client will be spawned *N widget. N = Tot clients connected.

*The work around is something like:

I tried binding SetKeyboardFocus in the Visible property of the UMG root, but to no avail. Is there no function to select widget focusing? If not, how would I go about handling this in code?

Kheka, I don’t have any duplicated widgets, according to debug. I tried your method, just in case, and there was no change.

What type of widget is Text Input UMG?

Bindings are meant to get values only, you shouldn’t attempt to perform actions that have side effects like that in them. SetKeyboardFocus is the function to set focus. I made a little test case that seems to work fine, when the button is clicked it focuses the text box.

It’s just the Widget Blueprint’s name. screenshot_2014_12_29_at_19_50_00.png

Your example works for me too. So, how could I interject any step of showing the widget on screen, to make the inputbox get focus? Where should I put the SetKeyboardFocus, if not as a bind? If I try to use SetKeyboardFocus outside of the widget events editor, it wants a Target of type Text Input Reference. o-O Like this:

Just make a new function / event on your chat window that does all this work called ShowChat. Instead of relying on the visibility state of the widget make it an explicit action to show and dismiss the chat window.


i don’t like to make new post and increase forms so going to brig this form back ,

I have a problem which is i have a chat system for mp project , when i press T the text box get Focus with SetKeyboardFocus , i want to send the chat when i press enter key but its not working as i’m already in the text box and the key event will not work i think so how can i fix this problem pls ?


already found a fix , in case anyone want to know i fixed it by event called ““OnTextCommitted (textbox)””