I’m trying to implement Drag and Drop system in my Inventory, but i’ve encountered a problem - when i override OnPreviewMouseButton event and put “Detect Drag if pressed” node in there, event onClicked stops working - it works only with second click, if i press the button twice, like if Detect Drag consumes the first click.
I’ve tried to use “Precise click” in button settings, but it doesn’t help.
Here’s my widget with button:
How can i make Detect Drag and onClicked work together?
I think this could be to do with the OnPreviewMouseButton overriding the On Clicked
I’m not sure you can directly fix this it might just be how the thing works, and i’m sure the standard OnMouseButtonDown doesn’t work with the drag system as it cant detect left click.
You could try handling your on clicked logic inside the OnPreviewMouseButton
use a event dispatcher, call a function or call an event if you don’t want to handle your logic inside the OnPreviewMouseButton
Hello! Take a look at this OnMouseDown and button in UMG - Blueprint Visual Scripting - Unreal Engine Forums. It seems that even if you are using Precise Click you can have problems with button Visual States. Can it be suitable solution to just have some decorator around Button for drag and drop purpose?
Yes, adding a border indeed solved a problem, thanks!
Thanks, i moved all the logic from onClicked to OnPreviewMouseButton, and now double click is handled correctly!