# Trying to add multiple instances of the same widget with different data to a scrollbox

**URL:** <https://forums.unrealengine.com/t/trying-to-add-multiple-instances-of-the-same-widget-with-different-data-to-a-scrollbox/430174>\
**Category:** UI\
**Tags:** unreal-engine, Widget, question, Blueprint\
**Created:** [July 24, 2018, 8:52pm UTC](https://forums.unrealengine.com/t/trying-to-add-multiple-instances-of-the-same-widget-with-different-data-to-a-scrollbox/430174 "2018-07-24T20:52:57Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_dd3d4d63](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_dd3d4d63](https://forums.unrealengine.com/u/anonymous_user_dd3d4d63)\
**Post date:** [July 24, 2018, 8:52pm UTC](https://forums.unrealengine.com/t/trying-to-add-multiple-instances-of-the-same-widget-with-different-data-to-a-scrollbox/430174/1 "2018-07-24T20:52:57Z")

</div>

So as the title says I’ve been trying to add different versions of the same widget to a scrollbox.

I did this with creating the same widget multiple times with a loop and adding it as a child each time with different data. This works fine.

The problem: Each widget has a button, with this button I want to add the content of that specific widget to an array that is in a different blueprint, but for some reason, I can’t. I add the data to the array in the widget blueprint but when I try to access the array elsewhere there is nothing in it.

I also tried it with simple variables but it seems like I can’t get any data out of these widgets to other blueprints.

Any reason why this happens? And what could be the solution?

Any help would be greatly appreciated. 🙂

(I can provide pictures of the blueprints if needed)

---

<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:** [July 24, 2018, 10:47pm UTC](https://forums.unrealengine.com/t/trying-to-add-multiple-instances-of-the-same-widget-with-different-data-to-a-scrollbox/430174/2 "2018-07-24T22:47:45Z")

</div>

What you describe should work fine.

> I add the data to the array in the  
> widget blueprint but when I try to  
> access the array elsewhere there is  
> nothing in it.

Can you show how you try to access the widgets’ data arrays elsewhere?  
Essentially the bit you expect to work.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_dd3d4d63](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_dd3d4d63](https://forums.unrealengine.com/u/anonymous_user_dd3d4d63)\
**Post date:** [July 25, 2018, 10:41am UTC](https://forums.unrealengine.com/t/trying-to-add-multiple-instances-of-the-same-widget-with-different-data-to-a-scrollbox/430174/3 "2018-07-25T10:41:41Z")

</div>

Thanks for your answer!

So I replicated the issue with just a variable:

 ![248449-bp1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/1/e/41e05b95c1e12d35b5a9440e0caf0f1c2c2c16f2.png)

In this widget when I press a button I create the other widget give it a random value and add it to a scrollbox.

At the end I get something like this:

![248453-hud1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/4/6/f46fdd4adbf169aa7d6a69fde25ee282b150ef99.png)

After this in the second widget on a button press, I try to change a variables value to the current widget’s value. (for example clicking the button on the first purple box should change the value to 7)  
This variable is declared in the first widget blueprint.

 ![248454-bp2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/9/1/391ce4d8e7a3c51833b39ab0e1bf378cbc89d266.png)

The print string displays the correct value.

After this I try to print the variable in the first blueprint.

![248455-bp3.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/4/e/b4e2942a34e0972bf757931fa327049a56bc13cb.png)

And for some reason it doesn’t work here.

(note that the engine version is 4.18.3)

---

<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:** [July 25, 2018, 10:58am UTC](https://forums.unrealengine.com/t/trying-to-add-multiple-instances-of-the-same-widget-with-different-data-to-a-scrollbox/430174/4 "2018-07-25T10:58:18Z")

</div>

I’m a bit confused. Not sure what your intentions here are but in the first picture, you’re extracting _just_ the canvas from the TestWidget2 and move it to the scrollbox, leaving an orphaned and canvasless TestWidget2 behind…

Perhaps you want to add the entire widget as content to the scrollbox instead.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_dd3d4d63](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_dd3d4d63](https://forums.unrealengine.com/u/anonymous_user_dd3d4d63)\
**Post date:** [July 25, 2018, 11:23am UTC](https://forums.unrealengine.com/t/trying-to-add-multiple-instances-of-the-same-widget-with-different-data-to-a-scrollbox/430174/5 "2018-07-25T11:23:31Z")

</div>

I tried it but I still have the problem.

The main problem is I can’t get any data out of the widgets that I create. Maybe the reason for it is because I create the same widget multiple times.

It is possible that I am doing something fundamentally wrong because I am a beginner.

---

<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:** [July 25, 2018, 11:37am UTC](https://forums.unrealengine.com/t/trying-to-add-multiple-instances-of-the-same-widget-with-different-data-to-a-scrollbox/430174/6 "2018-07-25T11:37:15Z")

</div>

Each widget you create is a separate instance and holds its own data.

Have a look at this:

 ![248456-capture.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/6/c/86cfce4a5ba1950b0c9a5e8b22af9161dcecb8a1.png)

I create a W\_Scrollbox widget and add 10 children to the scrollbox inside, each with a randomised Int. I then pick one at random and read the data inside. This works fine.

Perhaps you’d like to describe what you’re trying to create, I might be able to push you gently in the right direction. I mean the high level stuff - what the end user is supposed to with it.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_dd3d4d63](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_dd3d4d63](https://forums.unrealengine.com/u/anonymous_user_dd3d4d63)\
**Post date:** [July 25, 2018, 12:04pm UTC](https://forums.unrealengine.com/t/trying-to-add-multiple-instances-of-the-same-widget-with-different-data-to-a-scrollbox/430174/7 "2018-07-25T12:04:01Z")

</div>

Thank you for your answers 🙂

I will try your solution when I get home, and tell you if it helped.

By the way the end product supposed to be a list of randomly generated “people”, and the user would be able to put selected “people” into a different list. Like there are avaible workes and you can hire them.

---

<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:** [July 26, 2018, 9:56am UTC](https://forums.unrealengine.com/t/trying-to-add-multiple-instances-of-the-same-widget-with-different-data-to-a-scrollbox/430174/8 "2018-07-26T09:56:56Z")

</div>

Makes sense.

I’d then have a _JobBoard_ widget with 1 list containing _Persons_ widget and additional jobs lists (scrollboxes, right, ideally separate wigets) waiting to be populated.

AddChild (existing Person widget from JobBoard) to a Persons List should automatically reparent the Person from one list to another. This way you do not need to worry about making copies of the person (unless it is desired, of course.

Let me know if you’re having issues with setting this up.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_dd3d4d63](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_dd3d4d63](https://forums.unrealengine.com/u/anonymous_user_dd3d4d63)\
**Post date:** [July 30, 2018, 1:32pm UTC](https://forums.unrealengine.com/t/trying-to-add-multiple-instances-of-the-same-widget-with-different-data-to-a-scrollbox/430174/9 "2018-07-30T13:32:42Z")

</div>

Sorry for the late reply I could only try what you suggested today.

I replicated your blueprint and it works perfectly (thank you so much for that!) but the problem is that I can only get data out of the child by giving the index of it. How do I get the data out of the child with a button?

I tried it like this(this is the child’s bp):

 ![248921-bp.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/6/3/1637b4aafee3eca91a1ca082ec30add79521dc51.png)

but for some reason, it doesn’t work, it removes the widget from the current scrollbox but doesn’t add it to the other one.

Any reason why this happens?

And thanks again for the help so far!

---

<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:** [July 30, 2018, 2:38pm UTC](https://forums.unrealengine.com/t/trying-to-add-multiple-instances-of-the-same-widget-with-different-data-to-a-scrollbox/430174/10 "2018-07-30T14:38:10Z")

</div>

One way to do it is to have a child call an Event Dispatcher registered with a parent. I’ve quickly put this together to demonstrate the idea:

Video:

[https://drive.google.com/open?id=16f0aveOi7qRhtznOruxerjHwaSbCyWpn](https://drive.google.com/open?id=16f0aveOi7qRhtznOruxerjHwaSbCyWpn)

The 2 widgets are attached, feel free to take it apart:

[https://drive.google.com/open?id=1k2j\_Yd4YtX552q-w6LnzlGzxvImM1ews](https://drive.google.com/open?id=1k2j_Yd4YtX552q-w6LnzlGzxvImM1ews)

Do note that this if far from production ready 😉

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_dd3d4d63](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_dd3d4d63](https://forums.unrealengine.com/u/anonymous_user_dd3d4d63)\
**Post date:** [July 30, 2018, 3:20pm UTC](https://forums.unrealengine.com/t/trying-to-add-multiple-instances-of-the-same-widget-with-different-data-to-a-scrollbox/430174/11 "2018-07-30T15:20:56Z")

</div>

Thank you so much for doing this that is almost exactly what I wanted to make. 🙂

Now I’m updating my engine but after that I’ll try your blueprints.

---

<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:** [July 30, 2018, 3:25pm UTC](https://forums.unrealengine.com/t/trying-to-add-multiple-instances-of-the-same-widget-with-different-data-to-a-scrollbox/430174/12 "2018-07-30T15:25:51Z")

</div>

No problem, let me know if there’s anything unclear.

The list selection by double clicking is hard-coded. I wouldn’t do it like this normally. A much more sensible approach (especially with multiple lists) is to have them as separate widgets, with their own dispatchers and use the main JobBoard as a communication hub.

Anyway, this is a stub of something, hopefully it’s useful.

Good luck!
