# Drag and Drop

**URL:** <https://forums.unrealengine.com/t/drag-and-drop/629288>\
**Category:** Blueprint\
**Tags:** unreal-engine, UE5-0, Widget, UE4, question, Blueprint\
**Created:** [August 16, 2022, 6:39am UTC](https://forums.unrealengine.com/t/drag-and-drop/629288 "2022-08-16T06:39:03Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![RDJ3000](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RDJ3000](https://forums.unrealengine.com/u/RDJ3000)\
**Post date:** [August 16, 2022, 6:39am UTC](https://forums.unrealengine.com/t/drag-and-drop/629288/1 "2022-08-16T06:39:03Z")

</div>

Hello guys,  
Do you know how can i move this widget, so it dont duplicate, and it drags the actor under it with this widget?

> **[Gyazo](https://gyazo.com/d7e6e970e4206e810c21d6621a227f42)**
>
> Easily capture screenshots, GIFs, and replays that are ready to share. Download the free app for windows and mac.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [August 16, 2022, 7:24am UTC](https://forums.unrealengine.com/t/drag-and-drop/629288/2 "2022-08-16T07:24:47Z")

</div>

Feed the widget you drag as payload:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/8/2/882930249643a0fbde4601bf8fe588bde8624b29.png)

When you drop, add payload to a new container:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/e/f/0ef2b354819d37fdc7dac21e20b0d94524f9c15b.png)

Since a widget can only have a single parent ( 😢 ), it will be reparented.

* * *

> it drags the actor under it with this widget?

In the graph I posted there is a note about associating an actor with a widget - you can bind those two together.

You’d need to detect drag as before but use `onMouseMove` in map canvas to generate a coordinate, you can then update the widget’s actor.

---

<div class="post-metadata">

**Author:** ![RDJ3000](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RDJ3000](https://forums.unrealengine.com/u/RDJ3000)\
**Post date:** [August 16, 2022, 7:55am UTC](https://forums.unrealengine.com/t/drag-and-drop/629288/3 "2022-08-16T07:55:19Z")

</div>

![309200-annotation-2020-08-04-200106](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/0/f/90f909831b247bc48fda986faa9edebe6b8791b8.jpeg)  
So i need to use this example?  
if i understand you right

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [August 16, 2022, 8:06am UTC](https://forums.unrealengine.com/t/drag-and-drop/629288/4 "2022-08-16T08:06:38Z")

</div>

> and it drags the actor under it with this widget?

Assuming you want to update the actor every frame as you drag (rather than only when you re-drop), the generation of the coordinates will be identical for moving and dropping the widget about.

You can use the existing method - it’s at the bottom of the graph I posted above. You will still want to trace as you move the widget, as you may move it over a mountain.

---

<div class="post-metadata">

**Author:** ![RDJ3000](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RDJ3000](https://forums.unrealengine.com/u/RDJ3000)\
**Post date:** [August 16, 2022, 8:08am UTC](https://forums.unrealengine.com/t/drag-and-drop/629288/5 "2022-08-16T08:08:40Z")

</div>

Yep, it updates every frame but spawns actor each time i move and i drop it, is there a method an actor can move with this widget too?

> **[Gyazo](https://gyazo.com/9d2a71c7dfca838022bb4fa1e36fc356)**
>
> Easily capture screenshots, GIFs, and replays that are ready to share. Download the free app for windows and mac.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [August 16, 2022, 8:36am UTC](https://forums.unrealengine.com/t/drag-and-drop/629288/6 "2022-08-16T08:36:37Z")

</div>

While there are many ways of doing it, here’s how I would handle it. This example only covers the _onDrop_ update. (if I find the time later on, I’ll try to post the `onMouseMove` solution as well).

- in the _waypoint actor_, the widget is going to bind an Event Dispatcher to this custom event:

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/6/b/e6b44f6beabec084ab0c662177e7e69ec170b13d.png)

- in the _waypoint widget_; an Event Dispatcher taking a location vector and an additional bool keeping track of whether we need to spawn an actor for this widget:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/9/e/59e58bc5509dec63032c4738cac780128ec59892.png)

- when dropped, the payload is added to the canvas, we keep a local reference for later:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/7/c/57cc4a7b7281ef443927dcc0bd2fdb52f35ab54c.png)

- the rest of the same graph:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/0/1/80121d87eeca9b2006600c305b01824f78f06d95.png)

- dropping for the first time, reparents the widget and spawns a new actor, further drag & drops simply reposition the existing one:

* * *

But again, I can think of a number of ways of handling it. If you’re ok with hard references, you can create one in the widget and feed it the spawned actor.

---

<div class="post-metadata">

**Author:** ![RDJ3000](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RDJ3000](https://forums.unrealengine.com/u/RDJ3000)\
**Post date:** [August 16, 2022, 8:56am UTC](https://forums.unrealengine.com/t/drag-and-drop/629288/7 "2022-08-16T08:56:10Z")

</div>

Yo man thank you once again, you’re my personal angel or god of unreal engine. So much easier to learn

---

<div class="post-metadata">

**Author:** ![RDJ3000](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RDJ3000](https://forums.unrealengine.com/u/RDJ3000)\
**Post date:** [August 16, 2022, 11:56am UTC](https://forums.unrealengine.com/t/drag-and-drop/629288/8 "2022-08-16T11:56:52Z")

</div>

Hey sorry, one more detail, how can i do the waypoints infinite, so i can drag them over and over again?

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [August 16, 2022, 12:00pm UTC](https://forums.unrealengine.com/t/drag-and-drop/629288/9 "2022-08-16T12:00:50Z")

</div>

They are already _infinite_. It’s the _same_ waypoint widget that you drag again and again. Unless your implementation differs from mine.

> Hey sorry, one more detail, how can i do the waypoints infinite, so i can drag them over and over again?

Or do you mean that you want to have a waypoint on the side and then place any number of copies of it on the map?

* * *

> Do you know how can i move this widget, so it dont duplicate,

I guess I might have misunderstood you; you _do_ want to duplicate the widgets but you do not want those duplicates to spawn more than 1 actor to represent them - is that correct?

---

<div class="post-metadata">

**Author:** ![RDJ3000](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RDJ3000](https://forums.unrealengine.com/u/RDJ3000)\
**Post date:** [August 17, 2022, 3:01am UTC](https://forums.unrealengine.com/t/drag-and-drop/629288/10 "2022-08-17T03:01:40Z")

</div>

yep, this “heart” waypoint on the right needs to be infinite so i can drag them to the map as more as i want

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [August 17, 2022, 6:21am UTC](https://forums.unrealengine.com/t/drag-and-drop/629288/11 "2022-08-17T06:21:19Z")

</div>

Then create widgets as I did before, rather than reparent existing ones.

---

<div class="post-metadata">

**Author:** ![RDJ3000](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RDJ3000](https://forums.unrealengine.com/u/RDJ3000)\
**Post date:** [August 18, 2022, 3:40am UTC](https://forums.unrealengine.com/t/drag-and-drop/629288/12 "2022-08-18T03:40:21Z")

</div>

> **[Gyazo](https://gyazo.com/9fe8bc84b2fa9db98f649b06a96c3b5e)**
>
> Easily capture screenshots, GIFs, and replays that are ready to share. Download the free app for windows and mac.

Do you know how to make this widget or icon stay where actor stays or make it invisible when i zoom in?

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [August 18, 2022, 4:21am UTC](https://forums.unrealengine.com/t/drag-and-drop/629288/13 "2022-08-18T04:21:23Z")

</div>

Those widgets need to be a part of the widget that is being moved / zoomed.

Zooming or panning is generally done by nesting a canvas within another canvas and shifting the inner one around - not that dissimialar to dragging.

Remember me nagging about adding widgets to a canvas? I think I even mentioned moving the whole thing at that point - that’s how I would approach it.

The waypoints would need to become children of the container that being transformed.

* * *

I have a thread about zooming and moving a map out there, with a project attached. May be worth a look at in case you get stuck.

---

<div class="post-metadata">

**Author:** ![RDJ3000](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RDJ3000](https://forums.unrealengine.com/u/RDJ3000)\
**Post date:** [August 18, 2022, 4:31am UTC](https://forums.unrealengine.com/t/drag-and-drop/629288/14 "2022-08-18T04:31:46Z")

</div>

CAn you send me a link pls

---

<div class="post-metadata">

**Author:** ![RDJ3000](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RDJ3000](https://forums.unrealengine.com/u/RDJ3000)\
**Post date:** [August 18, 2022, 6:21am UTC](https://forums.unrealengine.com/t/drag-and-drop/629288/15 "2022-08-18T06:21:43Z")

</div>

And how can i make this widget part of it?

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [August 18, 2022, 6:27am UTC](https://forums.unrealengine.com/t/drag-and-drop/629288/16 "2022-08-18T06:27:26Z")

</div>

Add the waypoint to the canvas.

---

<div class="post-metadata">

**Author:** ![RDJ3000](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RDJ3000](https://forums.unrealengine.com/u/RDJ3000)\
**Post date:** [August 18, 2022, 6:29am UTC](https://forums.unrealengine.com/t/drag-and-drop/629288/17 "2022-08-18T06:29:33Z")

</div>

![25a363ee1214f55e5a21eced3361a077](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/4/d/74dea421ad255e1dad6af0ea20db363f0e104ce4.png)  
i thought its already added

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [August 18, 2022, 6:32am UTC](https://forums.unrealengine.com/t/drag-and-drop/629288/18 "2022-08-18T06:32:32Z")

</div>

Are you using this canvas to perform the zooming? Probably not.

A lot would also depend on how the zoom/pan is being done.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [August 18, 2022, 6:34am UTC](https://forums.unrealengine.com/t/drag-and-drop/629288/19 "2022-08-18T06:34:23Z")

</div>

> [@How to scale/zoom a widget with blueprints?](https://forums.unrealengine.com/t/how-to-scale-zoom-a-widget-with-blueprints/430983):
>
> I basically want to scale a widget that’s inside of another widget. I have many many buttons on a complex layout and I want users to be able to zoom in to select the specific button as well as zoom out to see the big picture. Basically, think of UE4’s blueprint window. I want it exactly like that. Mouse wheel zooms in until a specific zoom zooms out with a specific zoom. But it only affects that window. I always want to be able to pan like the blueprint window as well. I tried render scale of t…

---

<div class="post-metadata">

**Author:** ![RDJ3000](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RDJ3000](https://forums.unrealengine.com/u/RDJ3000)\
**Post date:** [August 18, 2022, 6:50am UTC](https://forums.unrealengine.com/t/drag-and-drop/629288/20 "2022-08-18T06:50:08Z")

</div>

> **[Gyazo](https://gyazo.com/e0e94d3679dbee39ce184bcdca83f281)**
>
> Easily capture screenshots, GIFs, and replays that are ready to share. Download the free app for windows and mac.

its inside my main widget, i need add to the canvas in this area?

[Next page](https://forums.unrealengine.com/t/drag-and-drop/629288.md?page=2)
