Right now I'm learning FLTK, and using OOP in it.
I have a class that contains everything, and I want to have a non-static callback (as this lets me use everything in the class). Callbacks have to be static, but it is possible, according to the documentation, to call, from the callback, a non-static method.
I get the error that it cannot call the non-static method without object.
So I have tried passing a custom *this using the following method:
in here, we are located in the constructor, that can use *this by default.
void* ptt = &*this;
So I pass *this as a void pointer. Then...
I make a pointer to this class object, get *this from the void pointer, essentially getting *this in a static method.
void application::s_enter(Fl_Widget* o, void* p)
me = (application*)&p;
Then I call the non-static method with the newly hand-made *this.
I still get the error!:
Please point me to my mistake, because I do not see it, not now at least.
error: cannot call member function 'void application::enter(application*)' without object
In case it helps, this is the function prototype for enter:
It never actually uses the pointer though, as I do not needed considering I have access to all of the class' attributes.