Re: XForms: Acceeding objects in tabbed folders

Steve Lamont (spl@szechuan.ucsd.edu)
Mon, 17 Aug 98 07:59:32 PDT

# To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :

> ... I find I bit cumbersome to acceed the
> different input fields and other objects of the different folders from
> a callback function of the main form (that containing the tabbed folder) ,
> for example, when I have to write the final file. ...

I'm not exactly sure what you mean by "acceed" -- do you mean "access"
perhaps? [The word "accede" means to take office, such as to ascend
to the throne, or to agree to something, such as to accede to
someone's argument means, basically, to agree with them -- I doubt
that's what you want].

If I understand your question properly, what you want to do is to read
values from a collection of Input and other objects which reside on
separate forms.

The cleanest way to do this is to create a structure that will contain
pointers to all your different forms and then attach that to either
the u_vdata field of each form or, perhaps, to the vdata field of the
FD_ object.

For instance,

typedef struct {

FD_some_form *fd_some_form;
FD_some_other_form *fd_some_other_form;
FD_yet_another_form *fd_yet_another_form;

} MyStruct, *MyStructP;

[...]

void some_callback( FL_OBJECT *ob, long data )

{

MyStructP my_struct =
( MyStructP ) ( ( FD_Any *) ob->form->fdui )->vdata;
FD_some_other_form *fd_some_other_form =
my_struct->fd_some_other_form;
FD_yet_another_form *fd_yet_another_form =
my_struct->fd_yet_another_form;
const char *input_data =
fl_get_input( fd_some_other_form->some_input );
const char *some_other_input_data =
fl_get_input( fd_some_other_form->some_other_input );

[...]

}

The other alternative, of course, it to make the FD_* structures
global themselves, but this is generally frowned upon for stylistic
and other reasons.

Hope this is responsive to your question.

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/