Skip to content

Cannot pass lambda expression as Button's on_click() function #323

Answered by ArthurSonzogni
georgjz asked this question in Q&A
Discussion options

You must be logged in to vote

Hello,

ScreenInteractive::ExitLoopClosure() returns the closure. It does not execute it.

So you should use

    Component exit_button = Button( "Exit", screen.ExitLoopClosure());

or:

    Component exit_button = Button( "Exit", [&screen] { screen.ExitLoopClosure()(); });

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@ArthurSonzogni
Comment options

@georgjz
Comment options

Answer selected by georgjz
Comment options

You must be logged in to vote
1 reply
@ArthurSonzogni
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #322 on February 02, 2022 13:40.