Download

Focus Widget Text Entry when Widget is component of an Actor

I created a widget blueprint, and added a single text box to it.
I added that widget as a component to an actor, and placed the actor in a level.
I see the widget, and using my mouse I can click into the text box and type.

How do I focus the text box on begin play? Or even on a key press like enter?

I’ve tried a few different ways, but none of them worked. I tried set keyboard focus in the level blueprint, but I can’t seem to get the correct reference to the text box. I tried setting it in the actor, but again, doesn’t seem to get the correct reference to the text box. I’m probably missing something stupid.

Anyone manage to get this working?

Figured it out. Inside the Widget Blueprint (in graph mode) you can do it using the Event Construct, BUT, you have to put in a delay or it doesn’t work.

a9eea1372d120ee9cf87eacf0844690323b4cfad.jpeg

I managed to get this to work from playercontroller. Hope it helps!

focus_textBox.png

Good to know, thanks Freestyledork