> ...
> class prodatum_controller
> {
>     // testdata
>     int data[2];
>     void set_data(int, int);
>     int get_data(int);
> public:
>     prodatum_controller();
>     // ui callbacks
>     void slider_cb(Fl_Slider*, void*);
>     void button_cb(Fl_Button*, void*);
>     // incoming MIDI data
>     // ...
> };
>
> I am having problems connecting the callbacks implemented by the
> controller with the widgets from the UI:
> ...
> // tried different things here but none of them compile:
>     device_info->callback((Fl_Callback*)button_cb);
> // error: ‘button_cb’ was not declared in this scope
> ...
> I am really not sure if I do as I should (C++ still confuses me).

This won't compile because of a quirk of callback handling in C++.
What you need to do is pass a 'static callback method' to callback()
and for that 'static callback method' to call the instance method.

This is covered in the info box in the Callbacks section of
http://www.fltk.org/documentation.php/doc-1.1/common.html#common

Cheers
D.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to