Allow 'Insert Child At' For Panel Widgets in Blueprint

Currently, if you want to insert a widget somewhere in the middle of a panel widget’s children, you can’t really do so unless you’re using a named slot. For creating data-driven procedural menus, this can be a real hassle sometimes. Especially if you want to use certain ‘pre-built template with slot content programmatically set’ in cases where a named slot widget isn’t enough (for instance, Scrollbox navigation only navigates between direct children, so if you put a widget in a scroll box that contains nested widgets, the scroll box will never allow navigation to the nested widgets and there is no way to override this without C++).

One reason this might not be currently available is that not all panel widgets support having more than one child. I’d settle for just having a method in panel widgets that do support this, but you can already call Add Child multiple times on a panel widget that only can hold one child. The default behavior, in this case, is to do nothing and return nullptr. Having InsertChildAt do nothing, in this case, would also be consistent.



if ( !bCanHaveMultipleChildren && GetChildrenCount() > 0 )
{
    return nullptr;
}


This feature has been missing for far too long and the workaround to this is cumbersome. +1

1 Like

+1 to that.

I created a basic one that I shared with Rama a while back, but it unfortunately causes the Construct event to be fired again :frowning: