x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Slate Button OnClicked_Lambda

I'm trying to bind a lamda to the OnClicked event of the SButton like so:

 SNew(SButton).OnClicked_Lambda([](){ GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Button Clicked!")); })

On compiling, I have the following error:

 c:\program files\epic games\4.7\engine\source\runtime\core\public\delegates\Tuple.h(113): error C2664: 'FReply::FReply(const FReply &)' : cannot convert argument 1 from 'void' to 'bool'
           Expressions of type void cannot be converted to other types

I thought that maybe it’s waiting for the lamda to return a bool and made it to return one:

 SNew(SButton).OnClicked_Lambda([]()->bool{ GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Button Clicked!")); return true; })

However, the error just changed to the:

 c:\program files\epic games\4.7\engine\source\runtime\core\public\delegates\Tuple.h(113): error C2248: 'FReply::FReply' : cannot access private member declared in class 'FReply'

Now I just don’t have any ideas at all, maybe it’s some bug?

Would very appreciate any hints, thank you!

Product Version: Not Selected
Tags:
more ▼

asked Mar 19 '15 at 05:47 PM in C++ Programming

avatar image

Elringus
105 13 20 30

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

You need to return the type FReply, eg FReply::Handled();

 SNew(SButton).OnClicked_Lambda([]()->FReply{ GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Button Clicked!")); return FReply::Handled(); })
more ▼

answered Mar 19 '15 at 06:07 PM

avatar image

Jamie Dale STAFF
7.5k 177 67 305

avatar image Elringus Mar 19 '15 at 06:44 PM

Working like a charm, thank you!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question