At least in 4.22 ReplaceChildAt(index, widget)
is not editor only, you might be thinking of ReplaceChild(widget, widget)
(the others are though)
So you have two options it seems (unless there’s some hidden swap function I don’t see):
Inherit from panel in C++ and write your own swap function either directly manipulating Slots
which is protected, or by exposing ReplaceChildAt
and implementing swap in BP.
Or you can write a BPLibrary in C++ and do the same. Either exposing ReplaceChildAt
by writing a function that takes the parent, or writing a swap function taking the parent and the widgets or their indices to swap.
For folks without a lot of inherent C++ know-how, I’d recommend the second as it keeps all Panel widgets available (vertical box, panel, etc), and there’s lots of examples of simple BP libraries online.