I am trying to do drag and drop from the widget where is the weapon icon to inventory which is in the left side, by the main widget blueprint how can I know which blueprint is clicked, dragged and dropped?
The dragged blueprint Detects Drag and creates a Drag Operation where you specify the Payload
- the widget you’re dragging.
The widget where you deliver the drag overrides onDrop, where you can use the Payload
pin to get to the widget you dragged here.
An example:
And a bunch of tutorials that cover this extensively:
https://www.youtube.com/results?search_query=ue4+drag+drop
If you have a specific question, do tell!
Thanks for your reply the problem that I am facing is that when I have four custom widgets which three of them is inside of the main one so I will call the four custom widgets main,1,2 and 3, what I want to do is make click event from widget 3 and to drop it into widget 1 but drop event only recognizes only inside the 3, so basically clicking an image icon from widget 3 makes a widget to drop that it will be dropped in the 1.
So no dragging operation is involved at all, it’s just about clicking?
Lets see if I got it right:
- this is my
wMain
, it has 2 other user widgets inside:
- if the goal is to click on the
wClickMe
and move it to the drop zone, I’d call a dispatcher in thewClickMe
:
- I’d have an event in the
wDropZone
- and have the main widget bind both widgets:
However, judging by the original image:
It seems that we have slots that will have some content and, once clicked, a slot should move its content to the inventory list? Or are we moving an entire slot? How close am I?
Sorry for my bad explanation, from Widget 3 you will drag and drop it onto Widget 1, when you drag it the slot image would be like this one, and it will be the Widget that is added onto the ListView from Widget 1
But isn’t this a standard drag & drop I suggested in my very first post?
Widget 3 you will drag and drop it onto Widget 1
DetectDrag
+ Create OP
in 3 and onDrop
in 1.
Why wouldn’t it work? What am I missing? My understanding is that we’re simply reparenting one widget from a container to another container using drag & drop.
Thanks! That did the trick.