Download

Slate menu problem

Hello.
I have a problem with menu based on slate. I have used example from https://wiki.unrealengine.com/Slate_Tabs .and added creating tabs into separate function. If I constructed tabs in separate function, I will receive:
2.png

If I constructed directly in Construct(const FArguments& InArgs) function, I will receive:
1.png

My function that separately build tabs menu


void SMainMenuUI::BuildSelectLevelMenu()
{
	m_SelectLevelBox->ClearChildren();

	m_SelectLevelBox->AddSlot()
	.FillHeight(0.1);

	m_SelectLevelBox->AddSlot()
	.FillHeight(0.8)
	
		SNew(SHorizontalBox)
		+ SHorizontalBox::Slot()
		.FillWidth(0.3)

		+ SHorizontalBox::Slot()
		.FillWidth(0.4)
		
                 // ... and other code from slate tabs example
}

How I used it:


void SMainMenuUI::Construct(const FArguments& InArgs)
{
	MainMenuHUD = InArgs._MenuHUD;

	//bind scale
	UIScale.Bind(this, &SMainMenuUI::GetUIScale);

	ChildSlot
	.VAlign(VAlign_Fill)
	.HAlign(HAlign_Fill)
	
		SNew(SDPIScaler)
		.DPIScale(UIScale)
		
			SNew(SOverlay)
			+SOverlay::Slot()
			
				SAssignNew(m_SelectLevelBox, SVerticalBox)
			]
		]
	];

	//call after SAssignNew(m_SelectLevelBox, SVerticalBox)
	BuildSelectLevelMenu();
}

and how I build tabs menu directly in Construct function:


void SMainMenuUI::Construct(const FArguments& InArgs)
{
	MainMenuHUD = InArgs._MenuHUD;

	//bind scale
	UIScale.Bind(this, &SMainMenuUI::GetUIScale);

	ChildSlot
	.VAlign(VAlign_Fill)
	.HAlign(HAlign_Fill)
	
		SNew(SDPIScaler)
		.DPIScale(UIScale)
		
			SNew(SOverlay)
			
			//tabs
			+SOverlay::Slot()
			

				SNew(SVerticalBox) 
				+ SVerticalBox::Slot()
				.FillHeight(0.1)
 
				+ SVerticalBox::Slot()
				.FillHeight(0.8)
				
					SNew(SHorizontalBox)
 
					+ SHorizontalBox::Slot()
					.FillWidth(0.3)
 
					+ SHorizontalBox::Slot()
					.FillWidth(0.4)
                                        // ... and other code from slate tabs example
}

What I am doing wrong? Please help me with that