# How do you rearrange the order of elements in a UMG Box?

**URL:** <https://forums.unrealengine.com/t/how-do-you-rearrange-the-order-of-elements-in-a-umg-box/472071>\
**Category:** UI\
**Tags:** unreal-engine, menu, Widget, question, UMG\
**Created:** [September 28, 2020, 12:35pm UTC](https://forums.unrealengine.com/t/how-do-you-rearrange-the-order-of-elements-in-a-umg-box/472071 "2020-09-28T12:35:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Unisink2020](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Unisink2020](https://forums.unrealengine.com/u/Unisink2020)\
**Post date:** [September 28, 2020, 12:35pm UTC](https://forums.unrealengine.com/t/how-do-you-rearrange-the-order-of-elements-in-a-umg-box/472071/1 "2020-09-28T12:35:55Z")

</div>

I want the player to be able to rearrange weapons on his list mincraft/stardew style but I can’t find the BP node to move elements around in a horizontal/vertical/wrap box. Anyone familiar with this?

---

<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:** [September 28, 2020, 12:59pm UTC](https://forums.unrealengine.com/t/how-do-you-rearrange-the-order-of-elements-in-a-umg-box/472071/2 "2020-09-28T12:59:25Z")

</div>

Very familiar, sadly. The functionality of inserting children into container lists is not exposed to BPs.

To pull it of in BPs

- keep widgets in an array
- swap array elements accordingly
- clear the widget container
- repopulate from the array

It’s not as inefficient as it sounds. The biggest drawback is slot formatting.

---

<div class="post-metadata">

**Author:** ![Unisink2020](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Unisink2020](https://forums.unrealengine.com/u/Unisink2020)\
**Post date:** [September 28, 2020, 1:27pm UTC](https://forums.unrealengine.com/t/how-do-you-rearrange-the-order-of-elements-in-a-umg-box/472071/3 "2020-09-28T13:27:09Z")

</div>

So I can place say, a horizontal box with 2 text boxes in a created named variable array and it will hold all the settings of the Horizontal box and all those text boxes, or am I unaware of the kind of array you are talking about?

---

<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:** [September 28, 2020, 2:02pm UTC](https://forums.unrealengine.com/t/how-do-you-rearrange-the-order-of-elements-in-a-umg-box/472071/4 "2020-09-28T14:02:15Z")

</div>

You want to change the order of elements on the ability / inventory bar - widgets that sit in a horizontal box. Add those widgets to an array and reorder that array instead. That is your new order of elements.

Similar to this:

> **[Looping elements in scroll box](https://forums.unrealengine.com/questions/984279/looping-elements-in-scroll-box.html)**
>
> Hi i am trying to loop elements in scroll box while going to top or bottom but when i increase the looping value i am getting error of infinite loop Video link: link text Project link: link text Here i am trying for infinite loop as far as i go...

But rather then inserting at the start / end you can actually swap elements:

![316284-screenshot-2020-09-28-150623.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/0/6/206891641f45004c8eebdfc81348fa37e3e11d80.jpeg)

---

<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:** [September 28, 2020, 2:10pm UTC](https://forums.unrealengine.com/t/how-do-you-rearrange-the-order-of-elements-in-a-umg-box/472071/5 "2020-09-28T14:10:10Z")

</div>

You asked about moving elements in a horizontal box directly, the above applies. However…

Normally, you approach something like this quite differently, you do not keep your abilities / skills / items _directly_ in a horizontal box. You create additional widgets that serve as slots. So you end up with a horizontal box with 10 empty slots that can hold any widget you need.

Each slot implements onDrop. If you drop onto a slot that already has something, you swap things around. If you drop onto a slot that is empty, you simply add the widget to that slot, and it will be automagically removed from the other one since widgets can have only 1 parent.

edit: just to visualise, here’s what I mean:

[![Image from Gyazo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/9/a/79a19984b14dfd408277270f145f51d9986a5301.gif)](https://gyazo.com/2a241a09c29416f16d5e625f1472f290)

 ![316277-screenshot-2020-09-28-153606.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/0/2/102921b67e27e1dda568a5642ed7adda43da4d5e.jpeg)

It’s a widget with slots (more can be added dynamically, of course). The slots implement onDrop. While the abilities implement dragging.
