Thanks for all your input.
I decided to program the UI by hand.
I am having problems with C++ though...

I am currently trying to get the basic structures (UI class, Controller Class, 
and data-Model Class) and make them work together.

I have no data-Model class yet. Instead the controller class contains some 
testdata that should be editable by some sliders:

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:


class prodatum_ui
{
    Fl_Double_Window *win;
public:
    prodatum_ui();
    void show();
};

extern prodatum_controller* controller;

prodatum_ui::prodatum_ui()
{
    win = new Fl_Double_Window(175, 225, "prodatum");
    win->begin();

    // testbutton
    Fl_Button* device_info = new Fl_Button(95, 5, 74, 25, "Info");


// 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

    device_info->callback((Fl_Callback*)&prodatum_controller::button_cb);
// error: converting from ‘void (prodatum_controller::*)(Fl_Button*, 
void*)’ to ‘void (*)(Fl_Widget*, void*)’

   device_info->callback((Fl_Callback*)controller->button_cb);
//error: invalid use of member (did you forget the ‘&’ ?)


    // testslider
    Fl_Widget *widget_array[2];
    int idx;
    for (idx = 0; idx < 2; idx++)
    {
        Fl_Slider* o = new Fl_Slider(20*idx, 0, 20, 127, NULL);
        o->type(FL_VERT_NICE_SLIDER);
        o->minimum(127);
        o->maximum(0);
        o->step(1);


// same here:
        o->callback((Fl_Callback*)&prodatum_controller::slider_cb, (void*)idx);
// error: converting from ‘void (prodatum_controller::*)(Fl_Slider*, 
void*)’ to ‘void (*)(Fl_Widget*, void*)’


        widget_array[idx] = o;
    }
    win->end();
}

void prodatum_ui::show()
{
    this->win->show();
}


I am really not sure if I do as I should (C++ still confuses me). Is this 
looking good to anyone? (Sorry for asking so many basic things).
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to