UMG Drag & Drop (UE 4.6)

How to use Drag & Drop? How i can do the same drag and drog that on screenshot?

Hey, anybody here?

This thread explains it pretty well: UMG - Drag&Drop capturing mouse events. - Blueprint - Unreal Engine Forums

Hi ,

Please do not bump threads that have not gone unanswered for longer than 4 days. This clutters the answerhub and makes it difficult to assist anyone.

Hello ,

I have an example widget that can get you started. The widget that is in the attached file can be placed in your project’s blueprint folder (It is from a 4.6 project). You can then open up the project and go from there. You will need to add it to viewport. >> [Drag and Drop Widget (This link is the complete widget) ][1] <<

My Event Graph:

In my example I am running things from a tick event. As you can see there are three images in the graph. These are what is being moved and parented to another canvas panel. The canvas panel is the one by its self in a comment box.

DragNDropFun:

This is my custom function when it is expanded. I have detailed what all of the different sections do. Currently the output pins are not working correctly due to a known issue, however this can be worked around.

Checking Macro:

This is the “Checking Macro” after it has been expanded. This basically checks to make sure that the widget that is being hovered over is the only one that moves. After then it is sure that you have the right widget it then ignores the “Is hovered node” for smoother dragging.

This is the mouse down function that can be found on the left under the mouse section of the “My Blueprints” panel in your widget. It is setting a boolean value that tell the function that the mouse is down.

Note: The On mouse down function looks the exact same except that the boolean is unchecked (setting it to false)

I hope this helps.

Make it a great day

Thanks. I will try it and reply.

This thread is don’t help me. I tried to do so as described in this topic. Nothing came, because there is nothing particularly shown and described.

Can you add DragNDropFun screenshot in highest resolution?

Ok. Thanks

Hello ,

I didn’t think a high resolution screen shot would be necessary because the widget is provided in the very first part of the post. You can simply double click the function in the provided file( Drag and Drop Widget ) to expand it and see the inner workings of the function. Just to be clear, the attached file is the entirety of the widget shown in the pictures above. I posted another link to it above in this post.

Note: To use the widget you can navigate to the content folder of your project and place it there after it is unzipped. If you have the engine installed in the default directory this folder can be found by going to Documents > Unreal Projects > Your project > Content

Thank you, I do not get enough sleep lately. :slight_smile:

Good, but like all translate into automatic mode? How do I know what a widget is now under the pointer?

Hello ,

The short answer is that you can use the “Is Hovered” node. This returns true when the pointer is over a widget. However, I have also added an image to try and explain a little further how my function works. I hope this answers your question.

Selection break down for my function:

Thanks for this.

When I have already dragged widget, the functions “such that” does not work when you drag a widget to the window in which I would like him to give up, so I can not figure out how to determine which window over my dragged widget.

That thread post specifically shows how is done in example. You just need the owning actor for step #2.

Doing this tutorial crashes my engine when pressing escape in the editor to come out of PLAYMODE… any suggestsions or previous experience/fix with this?

Hello walldiv,

I was unable to reproduce this issue on my end. I have a few questions for you that will help narrow down your issue.

Quick questions:

  1. What version of the engine are you using?
  2. Can you reproduce this in a clean project?
  3. If so, could you provide a detailed list of steps to reproduce this issue on our end?

Sorry for reviving this thread, but is there a way to get the coordinates of the moved widget? If i break down the location vector it gives me -138 & -159, which I can absolutely understand. While the widget is moved I have access to the real coords (Location X & Location Y pins), but I need them as an output in the event graph.

If you know what I mean,
please help :slight_smile:

Hello Calcrafter,

I would use the “Slot as Canvas Slot” and then use pull off of this node and get the position of the widget. I hope that this info helps.

48831-slotascanvasslothelp.png

As a side NOTE: this thread is fairly antiquated and the link provided by CodeSpartan would be a better way to do the drag and drop system.

Make it a great day