Not allowed to have OnMouseButtonDown in User Widget child class

I’m allowed to bind a function from a border to something named OnMouseButtonDown in a User Widget, but if I create a child class from a pretty much empty User Widget derived class, I’m no longer allowed to even if it’s not implemented in the parent class…

Hi Eobet

What you are doing in the image is failing because you are trying to create a new function. Since the OnMouseButtonDown function already exists in the parent, you’ll want to override it instead (like with what you’ve done for SelectOption and DeselectOption)

Also OnMouseButtonDown in UserWidget is a function, meaning you can’t bind anything to it. To do that it would have to be a Delegate (Event Dispatcher).

If you are wanting to have a Delegate for when mouse button is pressed down on this widget, you can override OnMouseButtonDown, and in it’s implementation call your own custom Delegate.

Let me know if you have any questions

1 Like

Thank you for the explanation!

Do you happen to have any tips on how to track down what’s consuming the mouse down in a project?

I’m overriding now as you said, and putting this everywhere:

image

I also use Game Only input mode but still can’t figure out the information from the debugger… the game is running here and I start it, click a few times in the game viewport and then stop it, but this time I can’t see the names of any of my own classes:

EDIT: Ok, hold on a second… I just discovered something which seems weird to me… the above On Mouse Button Down actually fires (I put a print in several to confirm), but still the input action for the mouse in the player controller only prints its statement on release, never on press. Why is that?