Slate: How to pass a variable along in the OnClicked event for a button?

You’re able to bind variables to a delegate; I can’t remember the exact syntax when doing this inside Slate (nor the names of the delegate), but it would be something along the lines of:

FOnClicked::CreateSP(this, &SMyWidget::OnClicked, MyVariableToBind)

MyVariableToBind would then be passed into SMyWidget::OnClicked as a parameter.

Slate might have the syntactic sugar to let you do that as (I’m not sure though, as I don’t often have to bind variables to a delegate):

.OnClicked(this, &SMyWidget::OnClicked, MyVariableToBind)
1 Like