I suspected as much with the Slot member but without the Cast it doesn’t list the Get/Set functions for Size/Position. The UTextBlock Slot member is of type UPanelSlot*. When casted as you listed above I now get an Access Violation in the Canvas code. Most likely either it’s a bad cast or the object hasn’t been created yet. If memory serves me correctly there’s a function that can be called that forces the widget to fully create itself but I can’t seem to find it now.
Not really without seeing more code showing the context in which you’re trying to do it.
Best bet would be to put a breakpoint in the debugger at the line of the cast, and check on the value of MyWidget->Slot that you are about to cast. The debugger should show you if it’s null, and if not, what kind of slot it is.
It’s a matter of order of operations. Creating the widgets alone doesn’t give them the inheritance to any future class that it may be appended to Basically, casting to Canvas anything without being added to the canvas won’t work, hence, the Access Violation. I ended up with the following: