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

Steve Lamont (
Mon, 24 Nov 97 07:48:33 PST

To subscribers of the xforms list from (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 );


To unsubscribe, send the message "unsubscribe" to or see
Xforms Home Page:
List Archive: