Hi!
How can I make one detail tab a child of another tab? I want it to be like details tab in blueprint editor:
- when you go to another tab (Materials, for example) - the details tab dissapears
- You can only dock this tab inside parent tab, and not in the same area where main tabs are
I’ve searched hard, and haven’t found anything bout this. ChatGPT suggests a lot of things, but all it’s code doesn’t work, and I haven’t worked with slate widgets before, so I’m lost.
My main tab:
TSharedRef<SDockTab> FSpellCreatorModule::OnSpawnPluginTab(const FSpawnTabArgs& SpawnTabArgs)
{
MainTab = SNew(SDockTab)
.TabRole(ETabRole::MajorTab)
[
SNew(SBox)
.HAlign(HAlign_Fill)
.VAlign(VAlign_Fill)
.MinDesiredWidth(400)
.MinDesiredHeight(200)
[
SNew(SVerticalBox)
+ SVerticalBox::Slot()
.Padding(5)
.HAlign(HAlign_Center)
.AutoHeight()
[
SNew(SHorizontalBox)
+ SHorizontalBox::Slot()
.Padding(5)
.HAlign(HAlign_Fill)
[
SNew(STextBlock)
.Text_Raw(this, &FSpellCreatorModule::GetText)
]
+ SHorizontalBox::Slot()
.Padding(5)
.HAlign(HAlign_Fill)
[
SNew(SWrapBox)
.PreferredWidth(300.f)
+ SWrapBox::Slot()[
SNew(SButton)
.Text(LOCTEXT("DefaultButtonText", "Open Class Picker"))
.OnClicked_Raw(this, &FSpellCreatorModule::OnButtonClicked)
]
]
]
+ SVerticalBox::Slot()
.Padding(5)
.HAlign(HAlign_Fill)
.VAlign(VAlign_Fill)
.AutoHeight()
[
GetVBox() //just a bunch of other SVerticalBox slots
]
]
];
return MainTab;
}
The tab I want to be it’s child:
TSharedRef<SDockTab> FSpellCreatorModule::CreateDetailsPanel(const FSpawnTabArgs& SpawnTabArgs)
{
UE_LOG(LogTemp, Warning, TEXT("CreateDetailsPanel Called"));
DetailsTab =
SNew(SDockTab)
.TabRole(ETabRole::PanelTab)
[
SNew(SBox)
.HAlign(HAlign_Fill)
.VAlign(VAlign_Fill)
.MinDesiredWidth(400)
.MinDesiredHeight(200)
[
SNew(STextBlock)
.Text(FText::FromString("Hello"))
]
];
return DetailsTab;
}
On button click function:
void FSpellCreatorModule::PluginButtonClicked()
{
FGlobalTabmanager::Get()->TryInvokeTab(SpellCreatorTabName);
MainTab->GetTabManager()->TryInvokeTab(DetailTabName);
}
and StartupModule:
void FSpellCreatorModule::StartupModule()
{
// This code will execute after your module is loaded into memory; the exact timing is specified in the .uplugin file per-module
FSpellCreatorStyle::Initialize();
FSpellCreatorStyle::ReloadTextures();
FSpellCreatorCommands::Register();
UToolMenus::RegisterStartupCallback(FSimpleMulticastDelegate::FDelegate::CreateRaw(this, &FSpellCreatorModule::RegisterMenus));
FGlobalTabmanager::Get()->RegisterNomadTabSpawner(SpellCreatorTabName, FOnSpawnTab::CreateRaw(this, &FSpellCreatorModule::OnSpawnPluginTab))
.SetDisplayName(LOCTEXT("FSpellCreatorTabTitle", "SpellCreator"))
.SetMenuType(ETabSpawnerMenuType::Hidden);
FGlobalTabmanager::Get()->RegisterNomadTabSpawner(DetailTabName, FOnSpawnTab::CreateRaw(this, &FSpellCreatorModule::CreateDetailsPanel))
.SetDisplayName(NSLOCTEXT("SpellCreatorModule", "DetailsPanelTabTitle", "Details Panel"))
.SetMenuType(ETabSpawnerMenuType::Hidden);
Any help appreciated.