No "On Drag Complete"?

I am completely baffled by this. There is an event called “On Drag Cancelled” that will allow you to detect if a drag fails to complete, but there is NO event that you can trigger if a drag completes succesfully. This is driving me crazy, because it seems like such a fundamental part of the drag and drop system that is just inexplicably missing, yet I can find NO documentation or explanation about it.

Literally, all I want to do is, “If drag completes successfully, do X. If drag is cancelled, do Y.” yet only HALF that functionality exists for some reason I still can’t comprehend. Can someone explain this?

Hey @KittyKatBlack! Welcome to the forums!

So assuming you mean the drop part of “Drag and drop”, it would be “OnDrop”. “OnDragCancelled” is for if you press any other keys while drag is being held, so “OnDrop” is when you stop dragging- essentially, “OnDragCompleted” :slight_smile:

No, “On Drop” only gives instructions to the target being dropped on. The original widget you pulled the drag and drop operation from has no idea that drop completed successfully, and can’t process anything from that event. That’s what’s confusing me.

On Drop is for the target of the drop.

There’s no similar operation for the source.

To give an example. Say you have a blue box and when you drag a from it, it creates a copy of itself. When it’s dropped on the red box, you want the blue box to turn green. You can make the red box turn green with ‘On Drop’, but you cannot make the blue box turn green because the blue box has no idea that the drop operation completed successfully on the red box. Does that make sense?

Okay, so you need to use this on the “draggable” so the blue square that’s being dragged around in your analogy (not the original not-yet-dragged version):

image

And a return node:
image

So THEN you have your “OnDrop”. So this would be on the widget with the canvas you’re operating on- so like the base level here. So as you were saying, the receiver of the drop- but through this method you can kind of “mirror” the “OnDrop”, if that makes sense.
image

There are a lot of funky ways around it, it seems but it just baffles me that this isn’t just a basic feature, considering how useful it would actually be. There is literally an “On Drop Cancelled” that lets you run an event if the drop fails. Why on earth there’s not one for when the drop succeeds is just completely beyond me.

One of the major issues I’ve run into so far is that I’m trying to make a drag and drop inventory, and I’ve managed to get it to work, but a simple process like swapping the places of two items is next to impossible simply because I can’t tell the originator of the drop “You now how have this item instead.” because there is no simple way to tell it, “I took your stuff and gave it to someone else. Update.” which is just… how did this go to version 5, with thousands of games being made on this platform and this is just… not a thing.

The way I thought I could make it work was since my inventory grid is just a bunch of widgets used as containers for other widgets, all I would need is some way to say, “Hey, the drag operation succeeded, give me a reference to your container and then delete yourself.” then on the On Drop I can just send a reference to the item that got dropped on to put itself in the container I just recieved…

But there is no way for me to get that information from the item since there’s no function that lets it know the drop completed to trigger it sending that information.

I got the same problem, the solution is in the OnDrop operations from the new widget, set the success return to true and the Drag blueprint is not running EventDragCanceled

That’s what onDrop is for in the Drag Operation:

It knows its payload, tell the payload what to do. Or use the custom payload called Widget Reference in @Mind-Brain’s example. This is also the place where you’d add dispatchers for some more funky behaviours, like reporting mouse position to the Player Controller who is, generally, oblivious during drag & drop.

the solution is in the OnDrop operations from the new widget, set the success return to true and the Drag blueprint is not running EventDragCanceled

Yes, This is really annoying. We can’t do anything because nothing is being executed.
If it returned a bool value directly, we can do anything we wanted…