Okay I’m trying to inherit from SButton and UButton, but for the life of me cannot figure out how to inherit the slate properties to be accessible in the subclass’ FArguments. Some in Engine examples seem to pull it off but I am failing to find how
okay, I don’t know that it’s necessarily the right way, but I did get it working.
I noticed that you can pass extra parameters into the slate constructor, so I just passed the parents FArguments like so:
void SMyButton::Construct(const SMyButton::FArguments& InArgs, const SButton::FArguments& InButtonArgs)
{
// handle your slate arguments
SButton::Construct(InButtonArgs);
}
and when constructing from UMyButton:
TSharedRef<SWidget> UMyButton::RebuildWidget()
{
SButton::FArguments ButtonArgs = SButton::FArguments()
.OnClicked(BIND_UOBJECT_DELEGATE(FOnClicked, SlateHandleClicked))
.OnPressed(BIND_UOBJECT_DELEGATE(FSimpleDelegate, SlateHandlePressed))
.OnReleased(BIND_UOBJECT_DELEGATE(FSimpleDelegate, SlateHandleReleased))
.OnHovered_UObject( this, &ThisClass::SlateHandleHovered )
.OnUnhovered_UObject( this, &ThisClass::SlateHandleUnhovered )
.ButtonStyle(&WidgetStyle)
.ClickMethod(ClickMethod)
.TouchMethod(TouchMethod)
.PressMethod(PressMethod)
.IsFocusable(IsFocusable)
;
MyButton = SNew(SMyButton, ButtonArgs)
// your slate properties
;
}
So far (as of 5 min and testing the delegates) it’s worked as expected