# \[UMG\] How can I get the ScrollBox's maximum offset?

**URL:** <https://forums.unrealengine.com/t/umg-how-can-i-get-the-scrollboxs-maximum-offset/333245>\
**Category:** UI\
**Tags:** scrollbox, unreal-engine, question, UMG\
**Created:** [September 24, 2015, 12:49pm UTC](https://forums.unrealengine.com/t/umg-how-can-i-get-the-scrollboxs-maximum-offset/333245 "2015-09-24T12:49:23Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Grogger](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Grogger](https://forums.unrealengine.com/u/Grogger)\
**Post date:** [September 24, 2015, 12:49pm UTC](https://forums.unrealengine.com/t/umg-how-can-i-get-the-scrollboxs-maximum-offset/333245/1 "2015-09-24T12:49:23Z")

</div>

I have a scrollbox within a Horizontal box and I’m trying to scroll manually using **GetScrollOffset** and **SetScrollOffset** , but I can’t find a proper value for the maximum scroll so it goes past the max and takes a while to come back up.

GetDesiredSize.Y is too large a value and casting to canvas panel slot returns size 0,0.

Any help is appreciated!

 ![60019-scrollboxsize.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/3/6/236ed09dbbe14bf6ab50fbdec64a2b33a613bb68.jpeg)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_4a9653f11](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_4a9653f11](https://forums.unrealengine.com/u/anonymous_user_4a9653f11)\
**Post date:** [January 28, 2016, 5:12am UTC](https://forums.unrealengine.com/t/umg-how-can-i-get-the-scrollboxs-maximum-offset/333245/2 "2016-01-28T05:12:54Z")

</div>

I would like an answer too! Had to cut a feature because I couldn’t figure this out and I can’t wait around for a solution.

How can Blueprint users manually change the scroll offset - particularly scrolling to the end _as the user sees it_ and not merely as Slate recognizes it? I had the exact same problem as OP.

---

<div class="post-metadata">

**Author:** ![ajarman88](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ajarman88](https://forums.unrealengine.com/u/ajarman88)\
**Post date:** [January 29, 2016, 2:06pm UTC](https://forums.unrealengine.com/t/umg-how-can-i-get-the-scrollboxs-maximum-offset/333245/3 "2016-01-29T14:06:17Z")

</div>

Hi,

The maximum scroll distance is the desired size - the actual displayed size.

Here is my method for scrolling down with a game pad

 ![76495-scroll+box+down+clamped.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/b/2/8b2d48e380df4ce03d50ad4fe486dda9e98f2a58.png)

---

<div class="post-metadata">

**Author:** ![Grogger](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Grogger](https://forums.unrealengine.com/u/Grogger)\
**Post date:** [January 29, 2016, 3:21pm UTC](https://forums.unrealengine.com/t/umg-how-can-i-get-the-scrollboxs-maximum-offset/333245/4 "2016-01-29T15:21:20Z")

</div>

Hi ajarman88, thanks for the reply 🙂

I haven’t tested this in 4.10, but this is precisely what doesn’t work in 4.9 in my scenario (GetSize returns 0 for the scrollbox and GetDesiredSize returns the size of the full content)

---

<div class="post-metadata">

**Author:** ![ajarman88](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ajarman88](https://forums.unrealengine.com/u/ajarman88)\
**Post date:** [January 29, 2016, 3:40pm UTC](https://forums.unrealengine.com/t/umg-how-can-i-get-the-scrollboxs-maximum-offset/333245/5 "2016-01-29T15:40:54Z")

</div>

Hi Grogger,

Is your scroll box an immediate child of the canvas?

If the scroll box is parented to a horizontal box for example, getting the canvas size directly will return 0 as the scroll box is not on the canvas.

The hierarchy below will cause the canvas size to return 0, for this you would need to get the size of the horizontal box on the canvas.

![76500-canvas+parent+1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/d/a/5da5015e343ed1e70e67c33d3c4cc6de35ad556f.png)

However if the scroll container is parented directly to the canvas, getting the canvas size should work, as it does in my case.

![76521-canvas+parent+2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/e/b/4eb58053f7d11a1919aa95813d66299d40b5837a.png)

---

<div class="post-metadata">

**Author:** ![Grogger](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Grogger](https://forums.unrealengine.com/u/Grogger)\
**Post date:** [January 29, 2016, 4:00pm UTC](https://forums.unrealengine.com/t/umg-how-can-i-get-the-scrollboxs-maximum-offset/333245/6 "2016-01-29T16:00:56Z")

</div>

Yup, that’s what’s happening. The workaround works great (thanks), though it’s unfortunate that it doesn’t return the proper size on the control - I’m using inheritance, so the function will be reusable, but the widgets won’t be the same.

Thanks again, I’m using this workaround for now 🙂

---

<div class="post-metadata">

**Author:** ![CelestialPanda](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@CelestialPanda](https://forums.unrealengine.com/u/CelestialPanda)\
**Post date:** [May 4, 2016, 4:06pm UTC](https://forums.unrealengine.com/t/umg-how-can-i-get-the-scrollboxs-maximum-offset/333245/7 "2016-05-04T16:06:43Z")

</div>

ajarman88, you are glorious. This has worked great for what I need!

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_fddbd04a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_fddbd04a](https://forums.unrealengine.com/u/anonymous_user_fddbd04a)\
**Post date:** [July 5, 2016, 1:37pm UTC](https://forums.unrealengine.com/t/umg-how-can-i-get-the-scrollboxs-maximum-offset/333245/8 "2016-07-05T13:37:28Z")

</div>

in case someone is coming by that is wanting to use this to set up the maximum scroll value in a configuration step on construct, you cant, it will return 0 for desired size, just do it 2 frames later

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_9fde53db](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_9fde53db](https://forums.unrealengine.com/u/anonymous_user_9fde53db)\
**Post date:** [June 21, 2018, 7:28pm UTC](https://forums.unrealengine.com/t/umg-how-can-i-get-the-scrollboxs-maximum-offset/333245/9 "2018-06-21T19:28:43Z")

</div>

Here a solution if your scroll box is not in a canvas pannel. Overlay Stats being the upper hierarchy of my scrollbox

 ![245061-scroll-box-gamepad.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/a/4/ba46c078d8857ac00d5e49e52fe5195edbd2192d.png)

---

<div class="post-metadata">

**Author:** ![DesertEagle\_PWN](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DesertEagle\_PWN](https://forums.unrealengine.com/u/DesertEagle_PWN)\
**Post date:** [June 28, 2018, 9:21pm UTC](https://forums.unrealengine.com/t/umg-how-can-i-get-the-scrollboxs-maximum-offset/333245/10 "2018-06-28T21:21:34Z")

</div>

The selected and upvoted answer has not worked for me; after subtracting off canvas slot sizes for parent widgets I’m still consistently left with too large of a Maximum offset.

After further investigation with the help of someone on the Unreal Slackers Discord it appears that subtracting parent canvas slot sizes are not actually providing the size of the visible geometry for ScrollBoxes inside other container/parent widgets.

The solution for these cases is to make use of the CachedGeometry exposed to blueprints for the ScrollBox and getting the local size, as so:

 ![245702-capture.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/2/b/22b330430f9636623c9c60797d28af08e4e18d7c.png)

---

<div class="post-metadata">

**Author:** ![vodkins](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@vodkins](https://forums.unrealengine.com/u/vodkins)\
**Post date:** [September 20, 2018, 10:33am UTC](https://forums.unrealengine.com/t/umg-how-can-i-get-the-scrollboxs-maximum-offset/333245/11 "2018-09-20T10:33:24Z")

</div>

Great solution! Only this working perfect in my case (solutions which uses Canvas are always returns with errors, despite they are actually worked). Thank you!!!

---

<div class="post-metadata">

**Author:** ![surmounter](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@surmounter](https://forums.unrealengine.com/u/surmounter)\
**Post date:** [August 14, 2023, 3:54am UTC](https://forums.unrealengine.com/t/umg-how-can-i-get-the-scrollboxs-maximum-offset/333245/12 "2023-08-14T03:54:11Z")

</div>

```auto
float UScrollBox::GetScrollOffsetOfEnd()

```

↑ Use This!

---

<div class="post-metadata">

**Author:** ![lit\_lee](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@lit\_lee](https://forums.unrealengine.com/u/lit_lee)\
**Post date:** [March 25, 2025, 10:20pm UTC](https://forums.unrealengine.com/t/umg-how-can-i-get-the-scrollboxs-maximum-offset/333245/13 "2025-03-25T22:20:30Z")

</div>

THIS IS IT!! Thank you so much!!
