Re: XForms: Creating and deleting forms whithin main loop?

Steve Lamont (spl@szechuan.ucsd.edu)
Mon, 24 Nov 97 07:48:33 PST

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

> Is it a correct thing to create or destroy a form will in
> fl_do_form (from a callback function)?

Yes. This is perfectly acceptable.

> By the way, what is the correct way to destroy properly
> a form and all its allocated ressources?

Here's what I do:

void destroy_object_form( FL_OBJECT *obj )

{

FL_FORM *form = obj->form;
void *dui = form->fdui;

fl_hide_form( form );
fl_free_form( form );
free( dui );

}

This function, when passed any object belonging to a form, first hides
the form then frees it and, finally, blows away the structure holding
all the (now invalid) pointers to the objects and the form.

This is generally called from a "go away" callback from some button:

void scram_cb( FL_OBJECT *obj, long data )

{

destroy_object_form( obj );

}

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/