On Key Down - Get Key - Missing Input

Hello,

I’m on a widget where i overwrite the On Key Down function.
I display the key pressed on the screen.

On the construct i define that:

Nothing exceptional !!

and on the Overwrite On Key down. I have that:

Yes the basics…

But when i test it. i can display all key except the key [Left, Right, Up, Down].
And i don’t know why.

image

Any idea why some key doesn’t response?

Inside the Widget, i open a widget switcher where i put another widget with the same logic… and there i have all the key write 2 times on the screen except for the arrow [left, up, right, down] i have them only 1 time…

So why those key doesn’t response in the first widget, and respond in the second widget?

You can see all key write 2 times… except the arrow… 1 time… but why they are writed 1 time…

And sometime it’s the arrow, sometime it’s the Enter key who doesn’t respond…

Any Idea??

I’m in Unreal Engine 5.1

Thanks for your help

My bet is that those missing keys are responsible for keyboard navigation and something eats up that input. If you place 2 buttons side by side:

image

You can highlight them with arrows and enter evokes a button press. Since that input was used up - consumed by the button, it no longer propagates and the keydown cannot see it.

Hard to tell more without seeing the hierarchy of the widget doing this.

Thanks for you reply.

The widget is like that:

image

I use that widget inside a main widget like that

image

So, in a nutshell:

  • the widget sitting directly in the viewport does not process arrow keys + enter
  • the same widget inside a switcher is happy to process arrow keys + enter

Correct?


I tried to reproduce it:

But it prints all keys, even ESC. There may be more to your setup that we’d to need to know about - not sure what to ask, though. Or there’s something special about UE5.

The arrows, enter and spacebar do not seem like a coincidence, almost sure. Widgets use them for keyboard navigation:

image

So, in a nutshell:
The MainUI widget (with Widget switcher) doest not process arrow keys + enter
The Press_Start widget is happy to process arrow keys + enter

Pres_Start is inside the MainUI in the Switcher component.

I will try to set the Event BegingPlay like you to see if there is any impact.

So it’s the switcher that messes it up and that’s with only a single widget in the switcher, right? And you want to process input in the widget the switcher holds.

Added the input processing widget to the switcher:

image

It sill fires all input keys :expressionless: What else am I doing differently?

With test, it’s that

I remove everything and put my Main UI like that:
image

The test result:
image

Now i put the second widget inside the switcher
image

And the Arrows Keys + Enter does not work anymore… :cry:

1 Like

Let me try with a new widget

1 Like

With a new widget

image

It works

image

So i guess something inside the widget has an issue?

My widget with the issue is build like that

image

I have deleted all component one by one, and the issue stay UNTIL i delete the Image component!

So their is an issu with the image component :frowning:

Like that:

image

The arrow key does not work…

Images can override mouseDown:

image

Can they do more in UE5?

It’s like that by default

I don’t use it (Not on my knowledge)

There is only that even on UE5.1

I have removed the image and put the image on the Border component (in the brush) and same result! not able to use arrow key anymore.

When i try to delete and recreate the Border, the arrow key doesn’t work anymore :slight_smile:

What is that magic??

Are you able to reproduce that on your UE version?
Do you think it’s something specific to UE5.1?

I have tested all keys on my keyboard and they all works except (PrintScreen, 4 arrows keys)

Nah, it works in 4.27.2. See if you can run this:

It should convert to UE5 on the spot. On my end, all input fires out of the box.

Hi, i can’t reproduce it anymore…

In fact on my second widget (Inside the switcher) i had also the “Is Focusable = true”

I put false, because it was already on the MainUi… and there it work even with images…
I put back true, and now it works normally and i can’t reproduce it anymore…

Do we need to set all “Is Focusable” on all sub widget (Those inside the Switcher) ?
Or only on the main one is enough?

Kr

You need isFocusable on the very widget that has onKeyDown implemented, only.

Those inside the Switcher

If that’s the widget that is supposed process input, it must be keyboard focusable. Its parent does not matter.

Its parent does not matter.

It may - there may be an edge case scenario where you want to process input in the child, pass Unhandled, and then process it again in the parent widget.

You need isFocusable on the very widget that has onKeyDown implemented, only.

Doest it mean that you open all your screen through the Blueprint? (like that?)

I guess if all Widget are build like that Parent-Child, when you display a new screen it needs to be “Is Focusable”.

But if I manage all screen inside only 1 Widget, i guess i only need to have that one “Is Focusable”

I don’t know if it’s a good practice, we learn all those things with differen YouTube Tutorial… and everyone has it’s own way of working…

Do you think it’s an issue to manage everything in one widget like that?
image

Like that i guess i only need 1 Widget “Is Focusable”?