For example:
I have class SMySlateWidgetClass and I want to make a ton of buttons.
I could do something like:
+SHorizontalBox::Slot()
[
SNew(SButton)
.Text(FText::FromString(TEXT("Do A Thing")))
.VAlign(VAlign_Center)
.HAlign(HAlign_Center)
.OnClicked(this, &SMySlateWidgetClass::OnDoAThingButtonClicked)
];
That’s fine for a few buttons but what if i had an array containing arrays of parameters for the button parameters and wanted to make a function to generate the buttons? How do I store the requisite method reference to set up the .OnClicked delegate?
When I look at the declaration for SButton or .OnClicked I only see the delegate macro and am having trouble finding where the parameter definitions are.
To boil it down I have two questions i think:
- How do I store a method pointer into a variable?
- How would I have found the answer to that in the code myself?
I come from a python background so I am still getting used to the verbose-ness of C++. I did try to find an answer to this, though I suspect I may have been using incorrect terminology. if there is an obvious answer on the internet somewhere, a link to that would be appreciated as well. ![]()