Next: Hiding and Showing, Previous: Input Fields, Up: Part I Defining Forms [Contents][Index]
Objects inside a form definition can be grouped together. To this end we place them in between the routines
FL_OBJECT *fl_bgn_group(void);
void fl_end_group(void);
The first function returns a pointer to a pseudo-object that
represents the start of the group (its class is
FL_BEGIN_GROUP
). It can be used in a number of functions to
work on the whole group at once. Also the second creates a
pseudo-object (of class FL_END_GROUP
), marking the groups end,
but since this object can’t be used its address isn’t returned.
Groups can’t be nested. Groups are useful for two reasons. First of all it is possible to hide groups of objects. (see Hiding and Showing below.) This is often very handy. We can, for example, display part of a form only when the user asks for it (see demo program group.c. Some attributes are naturally multi-objects, e.g., to glue several objects together using the gravity attribute. Instead of setting the gravity for each object, you can place all related objects inside a group and set the resize/gravity attribute of the group.
The second reason is for using radio buttons. As indicated in section 3.4 pushing a radio button makes the currently pushed radio button released. In fact, this happens only with radio buttons in the particular group. So to make two pairs (or more) of radio buttons, simply put each pair in a different group so that they won’t interfere with each other. See, e.g., the example program buttonall.c. It is a good idea to always put radio buttons in a group, even if you have only one set of them.
It is possible to add objects to an existing group
FL_OBJECT *fl_addto_group(FL_OBJECT *group);
where group
is the object returned by
fl_bgn_group()
. After this call, you can start adding
objects to the group (e.g., fl_add_button()
etc.). The
newly added objects are appended at the end of the group. When through
with adding, use fl_end_group()
as before.
Next: Hiding and Showing, Previous: Input Fields, Up: Part I Defining Forms [Contents][Index]