Fundamental Problems of Slate Writing with c++ Language,Please help

I see the following code in the official document:

I don’t quite understand.

SNew(SScrollBox)
+SScrollBox::Slot() .Padding(10,5)
[
    SNew(SHorizontalBox)
    +SHorizontalBox::Slot() .HAlign(HAlign_Left)
    [
        ...
    ]
    +SHorizontalBox::Slot() .HAlign(HAlign_Center)
    [
        ...
    ]
    +SHorizontalBox::Slot() .HAlign(HAlign_Right)
    [
        ...
    ]
]

What does the above [] mean? Please give me some help.

Square brackets are sugar syntax for slot content. You place new elements into them like in your example line #4. You could construct new element in place or preconstruct it somewhere else and later just inset it. You can think square brackets as “slots” where you insert stuff. If you need more functional Slate examples I would encourage you to browse Helium Rain Github repository as it is great learning example how to use Slate in game. If you are making editor tools then just fork Unreal from Github and look into it’s codebase. Nearly all Slate classes use prefix SSomeWidget…

1 Like

There are multiple examples of slate widgets in
Engine\Source\Runtime\AppFramework\Private\Framework\Testing folder.
inside SWidgetGallery.cpp file and others.

See there for examples of usage. If you dare.

cheers
Podge

Thank you very much. I’ll try it.

Thank you very much. I’ll try to finish something.