FLTK logo

Re: [fltk/fltk] What about an `Fl_Object` common base class to be able to `dynamic_cast`? (Discussion #1595)

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.discussions  ]
 
[ Previous Message ] [ New Message | Reply ] [ Next Message ]

Re: [fltk/fltk] What about an `Fl_Object` common base class to be able to `dynamic_cast`? (Discussion #1595) Matthias Melcher 22:06 Aug 30  
 

You can use lambda in FLTK 1.4, but they need to be capture-less. For example:

myWidget->callback( [](Fl_Widget*) { Fl::beep(); } );

Here, the Fl_Widget* is simply ignored, and the void* user data is not used.

FLTK 1.5 is in the process of allowing capturing lambdas as callbacks, so you will be able to write:

int myData = 42;
myWidget->callback( [myData, myWidget]() { myWidget->value(myData); } );

—
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/repo-discussions/1595/comments/18210515@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'.