How do you make a UImage widget absorb left mouse button press/release?

In FInputModeGameAndUI input mode, I have a UButton widget and a UImage widget in the HUD. I also have an input action bound to the left mouse button.

When the player clicks on the UButton the OnClicked event of the UButton fires and the pressed and released events of the input action are NOT sent.

However, when the player clicks on the UImage, the pressed and released input actions are sent.

Is there a way to configure the UImage to absorb the left mouse button pressed and released events like the UButton does? (By what mechanism does the UButton absorb the left mouse button pressed/released event?)

(I guess I could overlay a transparent UButton over the UImage, but is there an easier way?)

1 Like

I haven’t explored this in C++ yet but in BP if you add a binding to the OnMouseButton Down and return handled it should act similar to a button.


image

3 Likes

Here the C++ function you can see they return unhandled and that’s why the inputs are not consumed

2 Likes