C++ UE4 - Add child to SSscrollbox

1.2k Views Asked by At

I am trying to add dynamically a child in a SScrollBox but I get error.

TSharedRef<SScrollBox> MainCanvas = SNew(SScrollBox);
TSharedRef < SButton> TestButton = SNew(SButton);

MainCanvas->AddChild(TestButton); //AddChild not defined

It seems that addchild is not defined.

How could I add a widget inside scrollbox?

1

There are 1 best solutions below

0
On

you should use UScrollBox. UScrollBox is child class of UPanelWidget. so you can use AddChild(UWidget * Content) function.

also you should use UButton instead of SButton, too.