# \[UE5.1.1\] UInputKeySelector::SetTextBlockVisibility broken. Does not sync / sync on rebuild.

**URL:** <https://forums.unrealengine.com/t/ue5-1-1-uinputkeyselector-settextblockvisibility-broken-does-not-sync-sync-on-rebuild/1177644>\
**Category:** Issues and Bug Reporting\
**Tags:** unreal-engine, bug-report, slate, Widget, CPP, question, UMG\
**Created:** [May 25, 2023, 1:42am UTC](https://forums.unrealengine.com/t/ue5-1-1-uinputkeyselector-settextblockvisibility-broken-does-not-sync-sync-on-rebuild/1177644 "2023-05-25T01:42:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Roy\_Wierer.Seda145](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/roy_wierer.seda145/32/906551_2.png) [@Roy\_Wierer.Seda145](https://forums.unrealengine.com/u/Roy_Wierer.Seda145)\
**Post date:** [May 25, 2023, 1:42am UTC](https://forums.unrealengine.com/t/ue5-1-1-uinputkeyselector-settextblockvisibility-broken-does-not-sync-sync-on-rebuild/1177644/1 "2023-05-25T01:42:17Z")

</div>

Case:

On UserWidget::PreConstruct you want to do UInputKeySelector::SetTextBlockVisibility on an inner widget. It can fail silently:

```auto
void UInputKeySelector::SetTextBlockVisibility(const ESlateVisibility InVisibility)
{
	if (MyInputKeySelector.IsValid())
	{
		EVisibility SlateVisibility = UWidget::ConvertSerializedVisibilityToRuntime(InVisibility);
		MyInputKeySelector->SetTextBlockVisibility(SlateVisibility);
	}
}

```

Case:  
You want to set a few style properties in c++ on the widget.

```auto
SetButtonStyle(&DTPtr->WidgetStyle);
TextStyle = DTPtr->TextStyle;
Margin = DTPtr->Margin;

```

Well ■■■■! there is no setter for one or more properties as usual, so the widget won’t synchronize to slate automatically.

```auto
SynchronizeProperties();

```

Well ■■■■ again, because the synchronization method doesn’t check if it has been build yet, resulting in a crash (as usual with these slate frankensteins)

```auto
void UInputKeySelector::SynchronizeProperties()
{
	Super::SynchronizeProperties();

	MyInputKeySelector->SetSelectedKey( SelectedKey );
	MyInputKeySelector->SetMargin( Margin );
	MyInputKeySelector->SetButtonStyle( &WidgetStyle );

```

Well… Then we build it ourselves? Well ■■■■, if we do so the widget loses certain properties we set which haven’t been safely stored anywhere besides in the widget we just dump and rebuild, such as… The text block visibility.

```auto
TSharedRef<SWidget> UInputKeySelector::RebuildWidget()
{
	MyInputKeySelector = SNew(SInputKeySelector)
		.SelectedKey(SelectedKey)
		.Margin(Margin)
		.ButtonStyle(&WidgetStyle)
		.TextStyle(&TextStyle)
		.KeySelectionText(KeySelectionText)
		.NoKeySpecifiedText(NoKeySpecifiedText)
		.AllowModifierKeys(bAllowModifierKeys)
		.AllowGamepadKeys(bAllowGamepadKeys)
		.EscapeKeys(EscapeKeys)
		.OnKeySelected( BIND_UOBJECT_DELEGATE( SInputKeySelector::FOnKeySelected, HandleKeySelected ) )
		.OnIsSelectingKeyChanged( BIND_UOBJECT_DELEGATE( SInputKeySelector::FOnIsSelectingKeyChanged, HandleIsSelectingKeyChanged ) );
	return MyInputKeySelector.ToSharedRef();
}

```

You guys sure know how to mess up.

Add this to the list of my bug reports, I get 0 response from staff on Slate / UMG reports anyway. Unbelievable. You need to be able to set the visibility of the text widget if you simply want to swap between the input key name and a gamepad icon without the text. If we are supposed to actually use the provided Slate (slate / umg frankenstein) then at least make it work. I want to support this framework and not reinvent the wheel, but I’m not OK with the ■■■■ you ship with UE5.
