I built a class CommonButton
that inherits from UCommonButtonBase
.
I have several of them in a Scroll Box widget.
I make them selectable and I set a specific “selected style”.
I can see how the selected style applies whenever I click one of my selectable buttons - everything’s great.
However, I tried in various ways to bind functions to events of my common button and none of the events fire.
This is especially weird with this one:
DECLARE_EVENT_OneParam(UCommonButtonBase, FOnIsSelectedChanged, bool);
FOnIsSelectedChanged& OnIsSelectedChanged() const { return OnIsSelectedChangedEvent; }
… as I can see the selected-mechanism at work, only my events don’t fire.
I tried
Button->OnIsSelectedChanged().AddLambda([this] () { UE_LOG(...) });
and
Button->OnIsSelectedChanged().AddUObject(this, &AMyHUD::Shout);
where
void Shout(bool) { UE_LOG(...) }
Same with OnClicked()
I feel quite comfortable around delegates and events and the related syntax, but this one leaves me puzzled.