# Get widget size

**URL:** <https://forums.unrealengine.com/t/get-widget-size/398901>\
**Category:** UI\
**Tags:** size, unreal-engine, Widget, UE4, CPP, question\
**Created:** [June 18, 2017, 4:41am UTC](https://forums.unrealengine.com/t/get-widget-size/398901 "2017-06-18T04:41:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_5be014f9](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_5be014f9](https://forums.unrealengine.com/u/anonymous_user_5be014f9)\
**Post date:** [June 18, 2017, 4:41am UTC](https://forums.unrealengine.com/t/get-widget-size/398901/1 "2017-06-18T04:41:12Z")

</div>

Hey, I am trying to get my vertical box widget size.  
I have tried GetDesiredSize function but it is not the real size, it represents the size considered its children, what I want is the “borders” size which I setted in the widget blueprint:

[https://forums.unrealengine.com/attachment.php?attachmentid=145350&d=1497760344](https://forums.unrealengine.com/attachment.php?attachmentid=145350&d=1497760344)

How can I get it?

---

<div class="post-metadata">

**Author:** ![Firefly74](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Firefly74](https://forums.unrealengine.com/u/Firefly74)\
**Post date:** [June 18, 2017, 4:36pm UTC](https://forums.unrealengine.com/t/get-widget-size/398901/2 "2017-06-18T16:36:00Z")

</div>

not sur it’s what you are looking for, but there is nothing to get that value directly. so here what i do :

```
if you want the size in local scale ( the one in editor ) simply use 
  void UStyleEffectWidget::NativeTick(const FGeometry& MyGeometry, float InDeltaTime)
    {
    Super::NativeTick(MyGeometry, InDeltaTime);
    screenSize = MyGeometry.GetLocalSize();
    }

```

if you want the real size rendered : ( parent scale and viewport )

```
	UPROPERTY()
		FVector2D screenPosition;
	UPROPERTY()
		FVector2D screenSize;

void UStyleEffectWidget::NativeTick(const FGeometry& MyGeometry, float InDeltaTime)
{
Super::NativeTick(MyGeometry, InDeltaTime);

screenPosition = MyGeometry.LocalToAbsolute(FVector2D(0, 0)); //TopLeft
screenSize = MyGeometry.LocalToAbsolute(MyGeometry.GetLocalSize()) - screenPosition; // BotRight-TopLeft = real size
}

```

Edit : without tick method :

```
auto geometry = GetCachedGeometry();
auto localSize =geometry.GetLocalSize();

auto screenPosition = geometry .LocalToAbsolute(FVector2D(0, 0)); //TopLeft
auto screenSize = geometry .LocalToAbsolute(localSize ) - screenPosition; // BotRight-TopLeft = real size
```

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_5be014f9](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_5be014f9](https://forums.unrealengine.com/u/anonymous_user_5be014f9)\
**Post date:** [June 18, 2017, 6:31pm UTC](https://forums.unrealengine.com/t/get-widget-size/398901/3 "2017-06-18T18:31:03Z")

</div>

I prefer not creating a tick function

---

<div class="post-metadata">

**Author:** ![Firefly74](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Firefly74](https://forums.unrealengine.com/u/Firefly74)\
**Post date:** [June 18, 2017, 6:53pm UTC](https://forums.unrealengine.com/t/get-widget-size/398901/4 "2017-06-18T18:53:56Z")

</div>

then you can use “GetCachedGeometry()”  
( i Updated My answer )

---

<div class="post-metadata">

**Author:** ![tyoungjr](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@tyoungjr](https://forums.unrealengine.com/u/tyoungjr)\
**Post date:** [December 9, 2019, 9:24pm UTC](https://forums.unrealengine.com/t/get-widget-size/398901/5 "2019-12-09T21:24:34Z")

</div>

Another option is GetAbsoluteSize, it returns the same value.

---

<div class="post-metadata">

**Author:** ![lazyFrond](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@lazyFrond](https://forums.unrealengine.com/u/lazyFrond)\
**Post date:** [November 17, 2023, 1:10am UTC](https://forums.unrealengine.com/t/get-widget-size/398901/6 "2023-11-17T01:10:21Z")

</div>

everyones acting like its just that easy but I can’t figure out how to access my widget’s FGeometry to call GetAbsoluteSize
