I’m having a bit of trouble of hooking up a delegate to my Slate instance and I’m wondering how it should be done, does anyone have any suggestions. I’m a beginner when it comes to programming so forgive me if this seems obvious.
.WrapTextAt(float(TextIn = 1000))
.OnDoubleClicked(FOnClicked(one.Execute)) //part that doesn't work
I have a short writeup here on using Slate attributes and delegates. The jist of it is the syntax can be kind of finnicky depending on where you’re binding a delegate.
Thankfully, the declarative syntax (which is what you’re using in this case) is the most forgiving. You can nose around DeclarativeSyntaxSupport.h to see what’s supported. Now, OnDoubleClicked uses the FOnClicked signature: DECLARE_DELEGATE_RetVal( FReply, FOnClicked ). So you’ll need a function with no params and a single FReply return value. Say you name that function OnDoubleClickedHandler, binding it should be as simple as:
.OnDoubleClicked( this, &SMyWidget::OnDoubleClickedHandler )
Got it working mate, thanks a lot! I’ve managed to see whats supported in the syntax as well