How to insert a slot at specific location?

Hi ,

Currently I am able to dynamically add slot at the end by using AddSlot() function

GeneralWidget->AddSlot().HAlign(HAlign_Fill).Padding(10)
[
WidgetRow.ToSharedRef()
];

But suppose I want to change the value of a particular slot item , I am able to remove the slot item by using RemoveSlot() function , but how can I insert a modified slot value at the specified location?

I can do this by adding a method in the engine class SScrollbox.

SScrollBox::FSlot& SScrollBox::InsertSlot(int32 Index)
{
SScrollBox::FSlot& NewSlot = SScrollBox::Slot();
ScrollPanel->Children.Insert(&NewSlot , Index);

return NewSlot;

}

But I dont want to change the source code. I want to do this within my project classes only

GetChildren()->GetChildAt() will give you the pointer to your SWidget at specified location. You can use that, I guess.

I was unable to use that for inserting items at an index , and for removing item it was throwing run time error , so i added two new functions in the souce code and that is working. But i want to have all custom functions in my project and not in source code.

Please help if there is any other way.

So you want to insert the whole new SWidget instead of some value of this SWidget?

For a purpose like this I created my own scompoundwidget with TArray of pointers to my inner swidgets. I also added functions to this widget which reconstruct widget everytime the array of inner widgets changes. This way I always have access to any inner widget this scompoundwidget has and can change its contents.

Yes. Correct. And also I cant to this by declaring the widget and changing its value , since the same widget has been used to generate all the rows of the parent widget