You must use *static* methods as callbacks. You must realise
that because of this you can't reference the `this' pointer
from these methods. To reference the `this' pointer you have to
"store" it in the u_vdata part of the objects, this way:
class myclass
{
...
static void myobjectcallback(FL_OBJECT *, long);
void buildgui(void);
...
};
void myclass::myobjectcallback(FL_OBJECT *object, long data)
{
// retrieve `this'
myclass *This = (myclass *) object -> u_vdata;
...
}
void myclass::buildgui(void)
{
...
FL_OBJECT *myobject;
myobject = fl_add_<something>(...)
fl_set_object_callback(myobject, myobjectcallback, 0);
myobject -> u_vdata = (void *) this;
...
}
=============================================================
Julian Esteves
Laboratorio de Graficacion
Facultad de Ciencias, Universidad Nacional Autonoma de Mexico
=============================================================
On Fri, 13 Feb 1998, Christian Pomar wrote:
> # To subscribers of the xforms list from "Christian Pomar" <ipycp@arrakis.es> :
>
> Hi all,
>
> I am thinking of using C++ with xforms but I have some doubts.
>
> I have looked for references in the mail base and I've found some ideas. I
> thought that processing the 'fd' file and constructing C++ sources with a
> class structure (which should be defined before) would work. I don't know
> if it is possible (if the 'fd' format is well documented and stable) and if
> it is, if anybody has tried something like that. If nobody has, I will
> consider in doing it.
>
> The other question is callbacks and methods. Is there any solution for
> using a class method as a callback?.
>
>
> Thanks
> Christian Pomar
> _________________________________________________
> To unsubscribe, send the message "unsubscribe" to
> xforms-request@bob.usuf2.usuhs.mil or see
> http://bob.usuf2.usuhs.mil/mailserv/xforms.html
> XForms Home Page: http://bloch.phys.uwm.edu/xforms
> List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/
>
>
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
XForms Home Page: http://bloch.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/