Spawn tab with editable textbox and read out text.

Hey,

I finally created a Widget for Slate that does what I want and compiles. Yeah!
Never thought about, that I need a tab where I can assign it on. After hours of researching my head is full with things like Tabmanager, DockTab, Widget, SpawnTab… but I am stuck with putting all together.
What I basically want to do is creating a new UI tab with a editable textbox widget on it (later some checkboxes…), where I can write something in. After closing this tab I want to use this FText in c++.
As I mentioned before is the Widget ready to use, I am just curious about creating a new tab and assigning my Widget to it.

I hope someone can help me with this or give me a hint.

Best regards

Hi [USER=“685049”]Elias Kremer[/USER] first you can use the FGlobalTabManager to register a new tab and spawn your new brand widget there, you can do that inside the StartupModule override, here is the example I made for one of my plugins:



FGlobalTabmanager::Get()->RegisterNomadTabSpawner(PluginDistributorTabName, FOnSpawnTab::CreateRaw(this, &FPluginDistributorModule::OnSpawnPluginTab))
        .SetDisplayName(LOCTEXT("FPluginDistributorTabTitle", "PluginDistributor"))
        .SetMenuType(ETabSpawnerMenuType::Hidden);



the delegate OnSpawnPluginTab will call the next function when you open your tab:



TSharedRef<SDockTab> FPluginDistributorModule::OnSpawnPluginTab(const FSpawnTabArgs& SpawnTabArgs)
{
    return SNew(SDockTab)
        .TabRole(ETabRole::NomadTab)
        
            SNew(SPluginDistributor)
        ];
}



In my case I am using of course my own widget called SPluginDistributor, but now at this point you need a way to call this tab somehow, for this all you need to do is call the next function, this can be call from a button or whatever: FGlobalTabmanager::Get()->InvokeTab(PluginDistributorTabName);

if you want to be fancy you can register your own button to appear in the editor, and is totally the same case in the StartupModule override you can use something like this:



PluginCommands = MakeShareable(new FUICommandList);

    PluginCommands->MapAction(
        FPluginDistributorCommands::Get().OpenPluginWindow,
        FExecuteAction::CreateRaw(this, &FPluginDistributorModule::PluginButtonClicked),
        FCanExecuteAction());

    FLevelEditorModule& LevelEditorModule = FModuleManager::LoadModuleChecked<FLevelEditorModule>("LevelEditor");

    {
        TSharedPtr<FExtender> MenuExtender = MakeShareable(new FExtender());
        MenuExtender->AddMenuExtension("LevelEditor", EExtensionHook::After, PluginCommands, FMenuExtensionDelegate::CreateRaw(this, &FPluginDistributorModule::AddMenuExtension));

        LevelEditorModule.GetMenuExtensibilityManager()->AddExtender(MenuExtender);
    }


and like I said inside the method PluginButtonClicked is called the function to open your tab:



void FPluginDistributorModule::PluginButtonClicked()
{
    FGlobalTabmanager::Get()->InvokeTab(PluginDistributorTabName);
}



hope that works for you, this is 4.20.1 don’t know what version you are

Cheers

Hey thank you!
This helps a lot for understanding. Thank you!