Hey guys,
I´m having a hard time understanding Slate and its update behaviour in an editor plugin.
I have a SComboBox which shows a few categories. If I choose another option my OnSelectionChanged
event gets fired but the label on the checkbox doesn´t update.
Am I missing something how Slate draws itself? Do I need to “redraw” the UI?
If anybody can guide me to a proper guide on how to setup a Editor Window which has a lot of dynamic changes I will be forever grateful.
Having a hard time to find good documentation for Slate in the editor.
Example code:
void SCategoryComboBox::Construct(const FArguments& Args, std::vector<Category> categories)
{
setItems(categories);
ChildSlot
SNew(SComboBox<TSharedPtr<Category>>)
.OptionsSource(&Categories)
.OnSelectionChanged(this, &SCategoryComboBox::OnSelectionChanged)
.OnGenerateWidget(this, &SCategoryComboBox::MakeWidgetForOption)
.InitiallySelectedItem(SelectedCategory)
SNew(STextBlock)
.Text(FText::FromString(SelectedCategory->Name))
]
];
}
void SCategoryComboBox::OnSelectionChanged(TSharedPtr<Category> newSelection, ESelectInfo::Type)
{
SelectedCategory = newSelection;
}
TSharedRef<SWidget> SCategoryComboBox::MakeWidgetForOption(TSharedPtr<Category> inOption)
{
return SNew(STextBlock).Text(FText::FromString(inOption->Name));
}
Thanks!