BP Widget - Panel Slot Cast Fails

I’m trying to dynamically set the Padding (or Position) of a Widget Element but it seams that the cast from a panel slot reference to its actual type, always fails. Wheter I try to cast the Panel Slot Reference from a Horizontal Box to a HorizontalBoxSlot or the Canvas Panel Slot Reference itself to a Canvas Panel Slot, it always fails and triggers the “Cast Failed”.

I tried with different Widget Object Types like Boarder, Sized Box but they all fail to cast its slot to the proper class.
I also tried to make Variables of the Widget Object Types in case they’re not directly accessable but that also won’t work.

Is this a bug in the engine or am I doing something completely wrong?

The Event that triggers the cast is in the same BP (Widget) as the Horizontal Box I’m trying to manipulate.

I’ve got the idea from this post ==>>
[How can I dynamic to change the UMG’s widget position or padding][1]

Here’s a Screenshot of my BP:

The slot is from the containing widget. You cast to the container slot type. Such as you place an image inside a canvas panel and then you can cast the image’s slot to a canvaspanelslot. I think this is what your trying to achieve.

So I had to get the Slot from something inside the Horizontal Box to actually set the Position (Padding) of the Horizontal Box. Well it kind of makes sens now I read the word “Slot”… :wink: Thank you very much for your fast and accurate response!

For everyone else who stumbles on that: Here’s the working solution: