How to add a button into a custom editor window via new plugin

Dear Community,

How do I add a button to a newly created plugin’s editor window? I have done the following:

  1. Editor → plugin → new plugin → editor standalone window

  2. named it FirstEditorWindow

  3. Looking into a method in FirstEditorWindow.cpp called OnSpawnPlugin tab because the message in the editor window told me so…

    TSharedRef FFirstEditorWindowModule::OnSpawnPluginTab(const FSpawnTabArgs& SpawnTabArgs)
    {
    FText WidgetText = FText::Format(
    LOCTEXT(“WindowWidgetText”, “Add code to {0} in {1} to override this window’s contents”),
    FText::FromString(TEXT(“FFirstEditorWindowModule::OnSpawnPluginTab”)),
    FText::FromString(TEXT(“FirstEditorWindow.cpp”))
    );

    return SNew(SDockTab).TabRole(ETabRole::NomadTab)
    	[
    		// Put your tab content here!
    		SNew(SBox)
    		.HAlign(HAlign_Center)
    		.VAlign(VAlign_Center)
    		[
    			SNew(STextBlock)
    			.Text(WidgetText)
    		]
    	];
    

    }

  4. tried to replace SNew(SBox) with SNew(SButton) like this:

    SNew(SButton)
    .Text(WidgetText)

However, it didn’t work :confused: I have tried to find SLAT API documentation, but no luck.

Thank You all

Its a bit older but take a look at this Video. It gives you a good overview and Micheal Noland does a good Job at guiding you to examples you can find in Source Code to educate yourself. Keep in mind Engine has Changed since then and you have to addapt a few things here and there. There are a couple more ressources around the Web, Wiki and Github if you are willing to google Research a bit.

Cheers