Hi,
The following code works fine with Right Mouse Button but doesn’t fire with Left Mouse Button. Why is this and how do I get On Mouse Down Button and other events to work correctly with left mouse button?
Thanks!
Hi,
The following code works fine with Right Mouse Button but doesn’t fire with Left Mouse Button. Why is this and how do I get On Mouse Down Button and other events to work correctly with left mouse button?
Thanks!
I could only reproduce this by having two “On Mouse Button Down” events, one in the event graph and one on a border. Has to use a branch that handles it in a weird way too like your function not handling it on false.
Thanks for the suggestion. Still no dice with that approach. If I use this code (screenshot) then right click prints “Left Mouse False” but left click doesn’t print anything.
I’m only calling the one On Mouse Button Down which is the override function directly on my button widget. Nothing else in the event graph.
Actually, managed to find this thread (On Mouse Button Double Click Bug - #21 by anonymous_user_136e418c).
The solution seems to be to swap out On Mouse Button Down with On Preview Mouse Button Down. Very odd, but looks like the workaround.
Preview should be used as last resort only.
There’s something about the setup we do not know about. Detecting mouse keys in widgets is as straightforward as the above suggestion. Under regular circumstances, that is.
• you may have an interface layer that either steals focus or does not propagate it
• the element you’re clicking on might be nested in another widget, scroll box perhaps, they’re notorious
• the element you’re clicking on may contain a native button - buttons do not enjoy right clicks very much
• a combination of all three above?
Thanks. Yeah the problem is that I want my hud (not the button) to register the click when on an inventory button (as I’m going to drag the inventory icon to another slot and this way I can detect when mouse button is released). The button must consume it when clicked so the OnMouseDown doesn’t register from the hud.
I can use OnClicked from the button itself but then OnMouseUp doesn’t work.
And the reason I’m using buttons is because I’m using common button base so it nicely switches and lets me select the buttons when using a gamepad.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.