Input Event while mouse is hovering widget?

  • make the widget Focusable and ensure that at least 1 element is set to Visible
  • give it focus onMouseEnter and remove it onMouseLeave
  • override onKeyDown to intercept a keystroke and check which key was pressed
  • if the right key was pressed, execute your action
  • optionally, return Unhandled so the keystroke can tunnel to anything else that might need it

Thx so much for your answer it solved my problem I had no clue where to even begin on something like that. I’m still new to ue4 development.

I’m making an inventory system, and I’m trying to make it so when you press a key SPACE bar for example, it does nothing, but when you have your cursor above an item in the inventory and press SPACE it will use the item, I only need help on how I can detect both the cursor hovering and the key press event, the rest I have figured out. Thx for your time.