[Bugs bugs bugs] Slate widget synchronization

SetText to something, then get nothing when calling GetText.
Congratulations.

FText UEditableTextBox::GetText() const
{
	if ( MyEditableTextBlock.IsValid() )
	{
		return MyEditableTextBlock->GetText();
	}

	return Text;
}

void UEditableTextBox::SetText(FText InText)
{
	// We detect if the Text is internal pointing to the same thing if so, nothing to do.
	if (GetText().IdenticalTo(InText))
	{
		return;
	}

	Text = InText;

	BroadcastFieldValueChanged(FFieldNotificationClassDescriptor::Text);

	if ( MyEditableTextBlock.IsValid() )
	{
		MyEditableTextBlock->SetText(Text);
	}
}

Workaround: Manually “update” the text when text is committed… This is required when the text was “set” by typing into the editable text box, after which the getter returns nothing unless you call SetText like this yourself:


if (IsValid(EditableTextBoxWidget)) {
	EditableTextBoxWidget->OnTextCommitted.AddDynamic(this, &UMyWidget::ActOnEditableTextBoxCommitted);
}

void UMyWidget::ActOnEditableTextBoxCommitted(const FText& Text, ETextCommit::Type CommitMethod) {
	EditableTextBoxWidget->TakeWidget();
	EditableTextBoxWidget->SetText(Text);
}

Update UE5.2.1 Above workaround does not work anymore, the getter will return an empty value.
The story continues > [UE5.2.1, Bug report] EditableTextBox broke further. GetText not returning set value.