On Mouse Button Down not registering on Buttons

As of the update, my drag and drop operations stopped working, what I narrowed it down to is that the drag operation is not detected because the On Mouse Button Down(Overridden) function does not trigger.

Worked great in 4.16, now it just does not trigger.

Not sure if I am doing something in the old way or if this is just plain wrong (I did debug on this and even though I am on the correct widget, mouse press on the button in the widget registers OK, But the On Mouse Button Down plainly does not register the mouse button down, tried printing just plain string instead of detecting drag and nothing.

Edit0: Moved Drag detect to On Mouse Move(with couple checks) which triggers correctly, but the Overridden function OnDragDetected does not trigger anyway for some reason

Removed and recreated all the overridden functions but they still do not trigger on the events they should be triggering at.

By the way this is created mostly based on this tutorials, with some minor tweaks but the base is the same: Drag & Drop with UMG | 01 | Live Training | Unreal Engine - YouTube

Edit1: Tested it on Linux and Mac with the same result.

Edit2: After some further experiments it seems that if you create button than the on mouse button down is captured by that button and not sent forward, But if I create just text widget, or size box with image in it the event registers OK and drag is detected and everything works as it should. (Created empty project with everything fresh to test it)

This did work in 4.16!

If anybody wants to reproduce this

  1. Create new project
  2. Place the UI widget to your Content directory(Dropbox - NewHud.uasset - Simplify your life) - or create your own, it is just plain widget with overridden On Mouse Button Down(see link in main thread), and with overridden On Drag Detected with print text, and couple elements placed in the canvas panel).
  3. Add the widget to the viewport and enable inputs blueprintUE | PasteBin For Unreal Engine 4
  4. Try dragging from the button or from the text or from any element, once a button is involved the text will not be printed. - you can debug this one widget and see when the On Mouse Button Down is executed and when it is not.

Hi, that is the exact same issue, the button on the Hotkey widget catches the mouse event and does not let is pass through. If you want to get around it to be able to get the functionality you can drop the button as I do not think that he is using the buttons on clicked event in that tutorial. You will lose some of the graphics there(the hover and clicked effect) but otherwise it should work.

Well I never considered the forum to be more watched than thisā€¦ Yes precise click is enabled, I am aware of the tutorial you were following but my setup is not based on that.

By the way in a sense the button there is used just for the visuals and the enabled/disabled functionality of it, you can easily live without it or create your own visuals to simulate mostly the same. You are setting up the Deactivated? variable anyway so you can use that to do some branches on the caught events.

I am in process of figuring out what change caused it but the engine code is not as readable as one would wish and the merges for releases are even less convenient for that.

Same here. Iā€™ve tracked it down to exactly what youā€™ve described. With enough testing, Iā€™ve discovered that it still triggers for Right Click but not my Left Click. I wonder if it is a bug in 4.17 or there is another way to now do this.

1 Like

Is not a matter of workaorunds. The problem itself is easy to fix. I would like to know if this is a real bug or is a intended rework of how mouse buttons and on buttons override worksā€¦

same here. mouse down, on drag and double click all stopped working. i tried also do overrides again with no success. hmm.

same for me

Very similar issue. If i find a fix ill let you know.

Same here, i hope that they will fix this as soon as possible.,

The same for me

Same here

Iā€™ve been discussing this over on the forum (Link: On event double click not firing - Blueprint Visual Scripting - Unreal Engine Forums )

It may be worth checking that out and adding any input you may have.

Just to double check, have you got the button set to precise click? that seems to fix the issue for some.

Iā€™ve fixed this with the help of some none on the forum. It involves a little tom foolery but it works

If you make the the widget like this instead [Overlay] . [Border] . [Image] . [Text]

The do everything as you would have before but replace the button with the border and the set style with set brush Then override the functions ā€œone mouse enterā€ and ā€œon mouse leaveā€ and just set the brush in those to (OME) hovered brush and (OML) default brush it functions in exactly the same way as the button does.

Well right click is not caught by the button as the onclick event so that is why right click would work. What is the somewhat recommended workaround is to ditch the button in the widget, use border or image instead of it(which you can style in much the same way as the button) and handle all the events by yourself.

Sounds like issue UE-46656:

https://issues.unrealengine.com/issue/UE-46656

This is, at least for me, still an issue with version 4.17.2. I get the same symptoms as with that bug except I have ā€˜Default Viewport Mouse Capture Modeā€™ set to permanent.

Still an issue with 4.18. This bug effectively breaks much of my game (e.g. my entire inventory system no longer works, amongst other things).

Itā€™s frustrating that thereā€™s been a new version and a hotfix yet this very serious, game-breaking bug has been backlogged for five months.

Hey! I have already fixed this issue on an older project, but this project was thrown away. We had to change the engine settings in visual studios to make it work. I will try and find it again!

Ooh, that would be great if you could, thanks!

Change your OnMouseButtonDown to OnPreviewMouseButtonDown in your widget

2 Likes