Hello, I am spawning a custom widget called SItemWidget in a loop something like this.
TSharedPtr<SVerticalBox> Col;
SAssignNew(Col, SVerticalBox);
for (int32 i = 0; i < 4; i++)
{
Col->AddSlot()
.HAlign(HAlign_Fill)
.VAlign(VAlign_Fill)
[
SNew(SItemWidget)
.GameHUD(GameHUD)
.Test(i)
];
}
TSharedPtr<SHorizontalBox> Container;
SAssignNew(Container, SHorizontalBox);
for (int32 j = 0; j < 3; j++)
{
Container->AddSlot()
.HAlign(HAlign_Fill)
.VAlign(VAlign_Fill)
[
Col.ToSharedRef()
];
}
As you can see, SItemWidget has a variable called Test… In the first loop I can directly assign the value of Test. But, I am confused on how to do it in the 2nd loop.
In the 2nd loop I want my the Test variable to be set by the value of j. Is anything like that possible.