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


3.10 Deactivating and Triggering Objects

Sometimes you might want a particular object to be temporarily inactive, e.g., you want to make it impossible for the user to press a particular button or to type input in a particular field. For this you can use the routine

void fl_deactivate_object(FL_OBJECT *obj);

obj is the object to be deactivated. When obj is a group the whole group is deactivated. To reactivate the group or button use the routine

void fl_activate_object(FL_OBJECT *obj);

To find out if an object is in active state use the function

int fl_object_is_active(FL_OBJECT *obj);

Normally you also want to give the user a visual indication that the object is not active. This can, for example, be done by changing the label color to grey (see below). This is not done automatically, so unless you set e.g., a different color the objects appearance won’t change on deactivation (or re-activation).

It is possible to simulate the action of an object being triggered from within the program by using the following routine

void fl_trigger_object(FL_OBJECT *obj);

Calling this routine on an object obj results in the object returned to the application program or its callback being called if it exists. Note however, there is no visual feedback, i.e., fl_trigger_object(button) will not make the button object named button appear to be pushed.