Using std::function is really neat and keeps the callback where the widget constructor is.
I agree it can be nice to have a widget callback coded just below where its widget is constructed. My impression, however, is that this is practical only for very short (3 to 4 lines) callback functions. Making more complex ones into a separate function is generally necessary for code readability. A clear advantage of making a callback an std::function is when more than one data arguments are necessary; this approach seems a clear improvement over macros FL_FUNCTION_CALLBACK_# and friends.
I wonder whether class Fl_Callback_Interface could be used with Fl::add_timeout() to create a timeout?
— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.Message ID: <fltk/fltk/pull/1597/c5521825490@github.com>
Comments are owned by the poster. All other content is copyright 1998-2026 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.