Hi,
I am really hoping that I am missing a fundamental when it comes to slate but the last 3 of my projects have been haunted by this issue that I wasted a lot of precious time that I could spend on the betterment of the projects instead of trying to fix this issue.
Here is a screenshot of the widget reflector:
SAlineLibraryItem_Mesh is an SCompoundWidget.
Now, things are problematic inside the vertical box that is 3 rows below the selected one.
Each item has the same size, despite the fact that they all have Auto size and their actual size is different than their desired size. I pretty much surrounded my entire code with Invalidate function in an attempt to let the vertical box to shape itself properly to no avail. Here is a screenshot of my current result:
And the desired/actual sizes of the widgets:
The code that I use to generate these (Though the issue persists on pretty much everywhere that has Vertical/Horizontal Boxes;
void STagEditor::Construct(const FArguments& InArgs, UAlineLibraryItem_Base* Owner)
{
check(Owner);
IncludedTags = Owner->Tags.Array();
InheritedTags = Owner->InheritedTags.Array();
OnTagListChanged = InArgs._OnTagListChanged;
EditableText = SNew(SEditableText)
.OnTextChanged(this, &STagEditor::OnTextChanged)
.OnTextCommitted(this, &STagEditor::OnTextCommitted)
.OnKeyDownHandler(this, &STagEditor::OnKeyDownOnEditableText)
.HintText(FText::FromString("Enter a tag here, press ; to confirm"));
TagContainer = SNew(SWrapBox).HAlign(HAlign_Left).UseAllottedWidth(true);
TagSuggestionsVerticalBox = SNew(SVerticalBox);
TagSuggestionAnchor = SNew(SMenuAnchor).MenuContent(TagSuggestionsVerticalBox);
RefreshTags();
ChildSlot
[
SAssignNew(ContainerVerticalBox, SVerticalBox)
+
SVerticalBox::Slot().AutoHeight()
[
EditableText.ToSharedRef()
]
+
SVerticalBox::Slot()
[
TagSuggestionAnchor.ToSharedRef()
]
+
SVerticalBox::Slot().FillHeight(1.f).VAlign(VAlign_Fill)
[
TagContainer.ToSharedRef()
]
];
ContainerVerticalBox->Invalidate(EInvalidateWidgetReason::LayoutAndVolatility);
TagContainer->Invalidate(EInvalidateWidgetReason::LayoutAndVolatility);
}
I also dug into the UMG code with the hope to see that I can find the solution there to no avail. UMG works fine, but slate doesn’t. All I could see was invalidation.
Thank you in advance!