Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Get size of auto-sized widget

Hi there, I'm trying to get the size of a widget. I know I can do this like in the example below: alt text

However, this doesn't work with an auto-sized widget ("Size to content" inside of a canvas), because it always returns the size the widget has before it gets auto-sized. How can I get the final size the widget has when it's displayed with auto size?

Product Version: UE 4.18
sizeofwidget.png (26.7 kB)
more ▼

asked Mar 14 '18 at 01:44 PM in Blueprint Scripting

avatar image

11 1 2 3

avatar image Jiyko Sep 26 '18 at 08:10 PM

Ever find an answer to this?

avatar image Everynone Sep 26 '18 at 08:19 PM

Get Desired Size.

avatar image LukeScopegoat Oct 15 '18 at 03:53 PM

Returns 0,0 in this case, that's not what I need. There's this node:

Auto Size

But instead of just saying if It's autosized or not I need the actual Vector2. :D

unbenannt.png (51.5 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

alt text

Just call the ForceLayoutPrepass BEFORE you return the size of your autosized widget. :)

widgets.png (113.8 kB)
more ▼

answered May 04 '19 at 06:55 PM

avatar image

21 1 4

avatar image Ed.Kaminski May 13 '19 at 11:06 PM

Thank you for the visual!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Get Desired Size is what you are looking for. But you need to call it after some delay.

more ▼

answered Nov 06 '18 at 04:13 AM

avatar image

1 1 4

avatar image Everynone Nov 06 '18 at 07:28 AM

That's what ForceLayoutPrepass is for. Delay 0.0 should also work but it's more of a hack.

avatar image LukeScopegoat Mar 03 '19 at 07:38 PM

Sorry, forgot to answer this, ForceLayoutPrepass worked for me, thank you! :)

avatar image Ed.Kaminski May 02 '19 at 10:37 PM

How are you using ForceLayoutPrepass? I can't get the final auto-sized dimensions no matter what I try.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question