x

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"

How to get a UCanvasPanelSlot size

Hi All,

I created a custom widget then placed it inside a Canvas. I use Size To Content for the widget. Then I need to get the size of the widget to calculate new position in the Canvas (inside a viewport) whenever it is shown. However, if I use GetSize from the UCanvasPanelSlot for the widget, I got the value that specified in the Details (Class Default) panel (Size X and Size Y). The size of the widget, of course changed dynamically. But the GetSize() value always return the same value.

How could I get the UCanvasPanelSlotSize that is Size To Content?

Thank you in advance for all you help.

-cima-

Product Version: UE 4.8
Tags:
more ▼

asked Jul 07 '15 at 06:11 AM in Blueprint Scripting

avatar image

cima
26 1 2 6

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

2 answers: sort voted first

Never mind. Apparently the Geometry in NativeTick, stored the runtime data of the widget. It knows what its current size. So, each time it has different size, just update the size variable (custom variable) inside the widget and use it whenever needed.

more ▼

answered Jul 08 '15 at 05:06 AM

avatar image

cima
26 1 2 6

avatar image Zcience Apr 16 '17 at 12:22 PM

Alternatively you can try to get the UCanvasPanelSlot (if you're using a Widget with an UCanvasPanelSlot) to get the size:

alt text

You can see the kind of PanelSlot of an widget, when selecting it in the Designer Tab on the Details Panel:

alt text

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

how to do that?how to get the geometry data?I can't find it. update size variable?

more ▼

answered Aug 24 '16 at 01:44 PM

avatar image

zismylove
6 1 1

avatar image Zcience Apr 16 '17 at 12:25 PM

You can get it like this:

alt text

avatar image Swdan Apr 25 '17 at 10:28 PM

Zcience thanks. that solved

(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