As long as I am using dynamic ancors instead of fixed canvas slot size, the desired size of a widget can't be calculated.
If layout was calculated you can accsess to last cached geometry. This is true for widgets that was added a frame before and have ticked once:
MyWidget->GetCachedGeometry()
If you set widet size explicitly by using a canvas panel slot, you can get desired size by calling
auto Size = Cast<UCanvasSlot>(MyWidget->GetSlot())->Size;
or just call
auto Size = MyWidget->GetDesiredSize();
if widget was designed with SizeBox or some other widget that have a explicit fixed size property, wrapped around.
In more complicated cases you need to call
ForceLayoutPrepass();
to force desired size to be calculated.
You can read a great article that covers all that things here, if you not sure about what we are talking:
https://dawnarc.com/2018/12/ue4slate-and-native-umgc-notes/
Ok, nothing of that works for me
If nothing of that stuff works for you and you continue to get zeroes, there is last trick that you can try to do. The LayoutUtilites module goes to help. The trick is to walk upward in widget hierarchy by iterating through parents until you won't get widget with non-zeroed CachedGeometry and then use the geometry to calculate your newly-created widget that haven't been cached yet:
joya shoes 590f6idsyu805 outdoor,INSOLES,Joya Shoe Care,walking,fashion sneaker,boots joya shoes 462l4mycvt774
ОтветитьУдалить