简体   繁体   中英

C++ UE4 - Add child to SSscrollbox

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM