How to detect when a user clicks on a text box?

I am trying to perform an action every time a user right clicks on a UMG Text Box, not just when it gets focus. I have tried putting the Text Box in it’s own widget and overriding On Mouse Button Down/Up, but it appears that the Text Box consumes the event and On Mouse Button Down/Up is never called. Is there any way to detect this short of checking every tick?

I think you have two option :
first, you can put a button under your text box and check the Onclicked event of it. Or you can override the function “On preview mouse button down” of your widget.

1 Like

Was able to get this working with the ‘OnPreviewMouseButtonDown’ function. The text box consumes the click event so when I placed a button or anything else below it, their OnClicked event never fired.

this is still excellent advice 3+ years later. thank you Lunder.

ps the basics you’ll want to go the My Blueprint window, find the Functions Subsection, then mouse over ‘Functions’, find the Override button to the right, then find this function. once there, you’ll want to right click on the start of the function and probably add call to parent function, and plug the inputs from the overridden function into the parent call and the parent output into the output for the new overridden function.