From b966e87eb9e493d72c7bc87224eba34b0ff4ac84 Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Wed, 7 Jan 2026 15:21:41 +0100 Subject: [PATCH] Fluid: lambda --- fluid/nodes/Node.h | 5 +++-- fluid/nodes/Widget_Node.cxx | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/fluid/nodes/Node.h b/fluid/nodes/Node.h index 4f1f9c1bc..a589d9973 100644 --- a/fluid/nodes/Node.h +++ b/fluid/nodes/Node.h @@ -164,8 +164,9 @@ protected: const char *name_; /** Label text of a widget. */ const char *label_; - /** If it is just a word, it's the name of the callback function. Otherwise - it is the full callback C++ code. Can be nullptr. */ + /** If it is just a word, it's the name of the callback function. If it starts + with a '[', it's a lambda function. Otherwise it is the full callback + C++ code. Can be nullptr. */ const char *callback_; /** Widget user data field as C++ text. */ std::string user_data_; diff --git a/fluid/nodes/Widget_Node.cxx b/fluid/nodes/Widget_Node.cxx index 347a6025c..23662f7f3 100644 --- a/fluid/nodes/Widget_Node.cxx +++ b/fluid/nodes/Widget_Node.cxx @@ -1927,7 +1927,7 @@ void Widget_Node::write_widget_code(fld::io::Code_Writer& f) { std::string ud = user_data(); if (class_name(1) && !parent->is_widget()) ud = "this"; if (callback()) { - if (callback()[0] == '[') { + if (callback()[0] == '[') { // lambda callback function f.write_c("%s%s->callback(\n", f.indent(), var); f.tag(Mergeback::Tag::GENERIC, Mergeback::Tag::WIDGET_CALLBACK, 0); f.write_c_indented(callback(), 1, 0);