Next: , Previous: , Up: Part I Defining Forms   [Contents][Index]


3.12 Adding and Removing Objects

In some situations you might want to add objects to an already existing form (i.e., a form for which fl_end_form() has already been called. Reopening a form for the addition of further objects can be done by using the call

FL_FORM *fl_addto_form(FL_FORM *form);

After this call you can again add objects to the form with the usual functions for adding objects (like fl_add_button() etc.). When done with adding objects to the form again call fl_end_form(). It is possible to add objects to forms that are being displayed, but this is not always a good idea because not everything behaves well (e.g., strange things might happen when a group is started but not yet finished).

To remove an object from a form simply use

void fl_delete_object(FL_OBJECT *obj);

It removes the object from the form it currently belongs to and also from a group it may belong to. The argument can also be the pseudo-object starting a group (i.e., the return value of fl_bgn_group()) in which case the whole group of objects will be removed from the form.

Contrary to what the name of the function may hint at the object itself isn’t deleted but it remains available (except if it’s an object that marks the start or end of a group) and thus it can be added again to the same or another form (without having to call fl_addto_form() first and fl_end_form() afterwards) using the function

void fl_add_object(FL_FORM *form, FL_OBJECT *obj);

Normally, this function should only be used within object classes to add a newly created object to the form currently under construction. It can not be used for pseude-objects representing the start or end of a group.


Next: , Previous: , Up: Part I Defining Forms   [Contents][Index]