> My problem is that when I create Fl_MyWidget, its callback is automagically > set to Fl::default_callback(). My questions are: >
Somebody more knowledgeable than I may be able to correct me, but here's my understanding. > 1. What is the purpose of this callback? It's a no-op, but having it in place means that fltk internals don't have to always check it for null. They can just call "the callback," which presumably will always be either something installed by the user or the default which quickly does nothing. > 2. Is it safe to set the callback for Fl_MyWidget (in the ctor) to NULL? No, not really. If you do, you'll have to make certain that fltk never thinks it has to call your callback, otherwise you'll crash. Not worth the bother. 3. > 3. Also, the docs say that I _may_ want to use this default callback? If > so, for what purpose/what could I do with it? Just think of it as "no callback." For instance, in your example you could replace if(callback()) with if(callback() == fl::default_callback) and say callback(fl::default_callback) instead of callback(NULL). _______________________________________________ fltk mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk

