Many slate (U) widgets use setter methods to set their style properties and then sync to their (S) widget. Take a look at a few of those (U) widgets and see how half the properties do not synchronize or have such a setter method. Calling SynchronizeProperties() Manually is not an option, because the slate classes do not check if it is safe to do so by testing if their (S) widget is valid. Checking if their (S) Widget is valid manually is not an option, because in some cases (throbber widget) that property is private.
I haven’t got many good things to say about slate’s current design but someone needs to fix the current implementation. Some properties set from the editor panel don’t even update until the widget is recompiled.
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:
UE5.2 updates a bunch of slate widgets with new getters and setters, deprecating direct access to many properties. This is very good, because we need setters to sync Slate.
EPIC please test it properly because the editable text box and spinbox are already broken (see previous posts). Other than that, it’s good to see improvements on the synchronization process between Slate and UMG so that I am not forced to rebuild my widgets all the time after changing a single style property.
In 5.2, various getter / setter methods are still missing, though direct property access has already been deprecated. Please add these:
ComboBoxKey::ForegroundColor;
ComboBoxString::ForegroundColor;
ComboBoxString::Font;
UScrollBox::BackPadScrolling;
UScrollBox::FrontPadScrolling;
UScrollBox::NavigationScrollPadding;
For whatever reason there are two setters for this one, one is unsafe to call: