FLTK logo

Re: [fltk/fltk] Add lambdas with captures as callback option. (PR #1597)

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Library      Forums      Links      Apps     Login 
[  All Forums  |  Back to fltk.issues  ]
 
[ Previous Message ] [ New Message | Reply ] [ Next Message ]

Re: [fltk/fltk] Add lambdas with captures as callback option. (PR #1597) ManoloFLTK 06:57 Sep 03  
 
ManoloFLTK left a comment (fltk/fltk#1597)

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>

[ Direct Link to Message ]
 
     
[ Previous Message ] [ New Message | Reply ] [ Next Message ]
 
 

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'.