I am following the example of creating composite widgets from the FLTK2
documentation and have run into a problem. The composite widget class I have
created works if the it is used in main() -- with fltk::Window* initiated there
too -- but if I use it outside of main(), say in a constructor for a different
class, it will cause the program to crash when the callback is called. The
form of the callback is similar to that in the (Making your own Widgets)
documentation:
void MyClass::slider_cb(Widget* v, void *) { // static method
((MyClass*)(v->parent())->slider_cb();
}
void MyClass::slider_cb() { // normal method
use(the_slider->value());
}
As near as I can tell by using dbg, a pointer is lost in the static callback
function to parent(). Does anyone know why the callback above would crash if
called outside main()? The composite widget class is inherits Group and
parent() should point to that group, correct?
Thanks
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk