Sure! The widget switcher has many children. But it only shows/presents one at a time. It’s as if the others did not exist. Here is some sample code:
// Caveat: I wrote this in a hurry and did not actually
// compile it. ;)
class SMyExample : public SCompoundWidget
{
public:
SLATE_BEGIN_ARGS(SMyExample)
{}
SLATE_END_ARGS()
void Construct( const FArguments& InArgs )
{
TabIndex = 0;
this->ChildSlot
[
SNew(SWidgetSwitcher)
.WidgetIndex(this, &SMyExample::GetCurrentTabIndex)
+SWidgetSwitcher::Slot()
[
SNew(STextBlock).Text(NSLOCTEXT("MyExample","Page1","Page One")
]
+SWidgetSwitcher::Slot()
[
SNew(STextBlock).Text(NSLOCTEXT("MyExample","Page2","Page Two")
]
+SWidgetSwitcher::Slot()
[
SNew(STextBlock).Text(NSLOCTEXT("MyExample","Page3","Page Three")
]
];
}
private:
int32 TabIndex;
int32 GetCurrentTabIndex() const
{
return TabIndex;
}
};
Now if you set TabIndex
, you should be able to see Page One, Page Two, and Page Three appear depending on whether you set the TabIndex
to 0
, 1
, or 2
.
As a next step, you could use an SVerticalBox
to add a row of buttons above the the switcher. If you set those buttons to change the TabIndex
, you will have created a Tabs widgets. The upshot being that you have a lot of control over the appearance and behavior of these tabs as opposed to using a ready-made tabs widget. Indicentally, this is why we chose not to provide an out-of-the box Tab widget.
Let me know if this helps or if you have further questions. Also, if you do go on to make tabs out of this, could you post a simple code example? I think folks would appreciate seeing the code.