# Looping elements in scroll box

**URL:** <https://forums.unrealengine.com/t/looping-elements-in-scroll-box/471431>\
**Category:** Audio\
**Tags:** scrollbox, unreal-engine, loop, question\
**Created:** [September 16, 2020, 1:08pm UTC](https://forums.unrealengine.com/t/looping-elements-in-scroll-box/471431 "2020-09-16T13:08:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rag1804](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Rag1804](https://forums.unrealengine.com/u/Rag1804)\
**Post date:** [September 16, 2020, 1:08pm UTC](https://forums.unrealengine.com/t/looping-elements-in-scroll-box/471431/1 "2020-09-16T13:08:24Z")

</div>

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](https://drive.google.com/file/d/1rPVYcnhTNRlBoC-bPfuDzMXvzPNn85Xc/view?usp=sharing)

Project link: [link text](https://drive.google.com/file/d/1bowC4Ghm3v9cu9w2vyand7_SyoqIqJjp/view?usp=sharing)

Here i am trying for infinite loop as far as i go down or up the same elements need to be looped

Anyone please let me know how can i achieve 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:** [September 16, 2020, 4:29pm UTC](https://forums.unrealengine.com/t/looping-elements-in-scroll-box/471431/2 "2020-09-16T16:29:55Z")

</div>

There’s no support in UMG for that kind of thing so you need to fake it. Even the mighty _List View_ does not feature anything close to what’s really needed here.

* * *

See if that gets you closer to what you need:

- constructing widgets and adding them to an array

 ![313831-addwidgets.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/2/0/b2053fb984a511be8341d6077f377aae3eb7cf76.jpeg)

- the `Scroll Box` no longer consumes mouse input and is `Not Hit-Testable`

 ![313825-screenshot-2020-09-16-171043.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/8/5/585ece515a53beb503fc89d3217dd51b6dd09346.jpeg)

- instead of scrolling, we override `onMouseWheel` and manipulate the array
- the last item gets inserted at Index 0 or the first item is added to the end of the array
- we then call _Repopulate_ from the first screenshot

 ![313826-mousemove.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/1/d/f1dd11d6ebbb300bede57c255b0eb01b690995be.jpeg)

[![Image from Gyazo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/c/a/4cabf1777268187e8e6de894a385f48189aa750d.gif)](https://gyazo.com/76fcefc2092cc42997d1a73369165a3e)

Since the widgets are constructed only once, the performance hit here is not that bad, actually.

You could probably play with scrolling into view here, too - depending on what’s the desired effect.

---

<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 16, 2020, 4:33pm UTC](https://forums.unrealengine.com/t/looping-elements-in-scroll-box/471431/3 "2020-09-16T16:33:03Z")

</div>

Maybe the scroll box is not needed at all, who knows…

---

<div class="post-metadata">

**Author:** ![Rag1804](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Rag1804](https://forums.unrealengine.com/u/Rag1804)\
**Post date:** [September 16, 2020, 5:29pm UTC](https://forums.unrealengine.com/t/looping-elements-in-scroll-box/471431/4 "2020-09-16T17:29:13Z")

</div>

For clear look i am trying for animate scroll but i think it won’t work in our case  
Do you have any suggestion to show scroll animation for every event

---

<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 16, 2020, 5:36pm UTC](https://forums.unrealengine.com/t/looping-elements-in-scroll-box/471431/5 "2020-09-16T17:36:57Z")

</div>

As I said, play with the `Scroll into View` - it’s a feature of the scrollbox. You supply a widget or its index and the rest happens _automagically_ 😉

Not sure whether this would work here; worth trying, though.

---

<div class="post-metadata">

**Author:** ![Rag1804](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Rag1804](https://forums.unrealengine.com/u/Rag1804)\
**Post date:** [September 16, 2020, 6:13pm UTC](https://forums.unrealengine.com/t/looping-elements-in-scroll-box/471431/6 "2020-09-16T18:13:21Z")

</div>

Yes i have tried by using that node in between different excecution pins but as we are inserting dynamically animate scroll is not working. But if it works then it will be awesome

Even i tried to do UI animation but that also not going well as expected i don’t understand how to solve this
