> ... The problem is that I can only cast 1 structure to a long
> and pass it to the callback function. How can I access all 3
> structures in the callback.
I suggest *not* casting your structure pointer to a long. Remember
that on some machines longs and pointers are *not* the same length --
on the DEC Alpha, pointers are 64 bits while a long is only 32 bits!
> I have a solution, but I do not found it very elegant. What I do is
> create a structure str4 which groups all 3 other structures
> typedef struct
> {
> str1 a;
> str2 b;
> str3 c;
> } str4
> and I pass this structure through the (long) casting to the
> callback. Is there a better way?
This is partially the Right Thing but instead of using the data
parameter of the callback, consider using the u_vdata pointer which
hangs off the FL_OBJECT structure -- that's what it's there for.
There's also a similar member of the FL_FORM structure which is
reserved for application use.
In addition, there's a member in the FL_FORM structure (fdui) which
points back at the FD_whatever structure created by fdesign. The
FD_whatever structure also has a field (vdata, in this case) upon which
you can hang an application defined pointer to whatever you wish.
I generally use this member to point to some sort of form-wide context
structure and use the FL_FORM and FL_OBJECT u_vdata fields to point to
somewhat more transient data.
> I also have a button `load configuration'. An additional problem is
> that when I load another configuration file, how do I update all the
> fields from the callback `cbLoad' function?
I presume you're concerned about accessing the fdesign generated
FD_whatever structure.
Just use the functions provided for setting object values. You can
access the FD_whatever structure as follows:
void my_callback( FL_OBJECT *obj, long data )
{
FD_whatever *whatever = ( FD_whatever *) obj->form->fdui;
[... read your data ...]
fl_set_object_label( whatever->some_object, some_label_data );
[... and so forth ...]
}
spl
_________________________________________________
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://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/