UMG Widget buttons with keyboard focus not responding to Enter key.

I need my menus to be usable with keyboard, not only mouse.

Buttons are procedurally added and, just after populating the menu with the buttons, I set the keyboard focus to the 1st one. Buttons with keyboard focus turn red.

Like this:


My problem is that pressing Enter to choose that 1st option (“Good” in the example image) is not activating the button. It has keyboard focus (the blue outline confirms that) but it does not react to Enter key.

I have to change keyboard focus to the second button and go back to the 1st one (with cursor down/up keys), then it works.

In other words, I need to move the keyboard focus with cursor keys to make it work. The procedurally assigned keyboard focus is not working.

This is the widget blueprint section

or this…

You see… I’ve already tried with and without a delay (sometimes it’s just that simple), with and without an intermediate variable to store the reference to the button, tried setting keyboard focus again after the Set Input node, tried with and without “flush Input” option… nothing works.

¿Anyone has a clue about this?

1 Like

I’ve been procrastinating the solution to this problem but deadline is coming and it’s time to solve it.

so, Bump!

Hi there @icierva,

Hope you’re well!

This topic has been moved from International to Programming & Scripting: Blueprint.

When posting, please review the categories to ensure your topic is posted in the most relevant space.

Thanks and happy developing! :slight_smile:

facing a second version of this project and this problem persist.

So, bump again!

Solved overriding the function OnKeyDown in the generic button graph.

1st, add a custom event next to the procedure executed when mouse-clicking the button:

and then, override the function “On Key Down” to make it call the custom event when Enter key is pressed. Like this:

That was all.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.