# SComboBox "No Content Provided"

**URL:** <https://forums.unrealengine.com/t/scombobox-no-content-provided/410394>\
**Category:** UI\
**Tags:** unreal-engine, slate, question, UMG\
**Created:** [November 23, 2017, 1:21pm UTC](https://forums.unrealengine.com/t/scombobox-no-content-provided/410394 "2017-11-23T13:21:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_00b397c41](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_00b397c41](https://forums.unrealengine.com/u/anonymous_user_00b397c41)\
**Post date:** [November 23, 2017, 1:21pm UTC](https://forums.unrealengine.com/t/scombobox-no-content-provided/410394/1 "2017-11-23T13:21:13Z")

</div>

I am creating a new SWindow and filling it with Content:

> ```
> SAssignNew(ControlWindow_SharedPtr, SWindow).Content() [...];
> 
> ```

Part of the Content are ComboBoxes.  
But the SComboBoxes are not showing any of the Options they are given:

> ```
> TArray<TSharedPtr <FString>> Array_Resolutions = {MakeShareable<FString>(new FString("2560 x 1440")), MakeShareable<FString>(new FString("1920 x 1080"))};
> 
> ```

[…]

```
				SNew(SHorizontalBox)
				+ SHorizontalBox::Slot()
					.VAlign(VAlign_Center)
					.HAlign(HAlign_Center)
					[
						SNew(STextBlock)
						.Text(FText::FromString("Resolution:"))
						.ToolTipText(FText::FromString("Change the resolution of the output window (Width x Height)."))
					]
				+SHorizontalBox::Slot()
					.VAlign(VAlign_Center)
					.HAlign(HAlign_Center)
					[
						SNew(SComboBox<TSharedPtr<FString>>)
						.OptionsSource(&Array_Resolutions)
						.OnSelectionChanged_Lambda([](TSharedPtr<FString>, ESelectInfo::Type)
						{
							
						})
						.InitiallySelectedItem(Array_Resolutions[1])
					]

```

[…]

![221230-scombobox.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/7/6/d76f6669703161f7d0594c1a6e53021a9a71be57.png)

Does anybody know why the ComboBoxes do not hold the Array Items as Options?  
The ComboBox with the Resolution should hold both Strings (2560 x 1440 and 1920 x 1080).  
(The code for the ‘Mode’ ComboBox is basically a copy paste of this one just with some other array).

Clicking on the ComboBoxes is crashing both the game and the editor.

---

<div class="post-metadata">

**Author:** ![c4tnt](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@c4tnt](https://forums.unrealengine.com/u/c4tnt)\
**Post date:** [November 23, 2017, 9:17pm UTC](https://forums.unrealengine.com/t/scombobox-no-content-provided/410394/2 "2017-11-23T21:17:29Z")

</div>

Hi. You have to provide .OnGenerateWidget( this, &Class::GenerateCBContent ) argument.

It have following signature: TSharedRef GenerateCBContent( TSharedPtr\< FString \> Value )  
and should return widget to display a specific item inside combo box menu.

Simple implementation for FString looks like that:

```
	TSharedRef<SWidget> GenerateCBContent( TSharedPtr< FString > Value )
	{
		return SNew(STextBlock) .Text( FText::FromString(Value) );
	}
```

---

<div class="post-metadata">

**Author:** ![aliasense](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@aliasense](https://forums.unrealengine.com/u/aliasense)\
**Post date:** [November 18, 2020, 4:57am UTC](https://forums.unrealengine.com/t/scombobox-no-content-provided/410394/3 "2020-11-18T04:57:37Z")

</div>

It needs to read  
return SNew(STextBlock) .Text( FText::FromString(\*Value) );  
with \*Value to compile.
