void flx_set_input_printf(FL_OBJECT *obj, char *format, ...); void flx_set_input_float(FL_OBJECT *obj, float f); void flx_set_input_int(FL_OBJECT *obj, int i); float flx_get_input_float(FL_OBJECT *obj); int flx_get_input_int(FL_OBJECT *obj); void flx_enable(FL_OBJECT *obj, int lcol); void flx_disable(FL_OBJECT *obj, int lcol); FL_OBJECT *flx_findobject(FL_FORM *form, char *label);
The formsx library contains functions which extend the FORMS graphical user interface toolkit.
flx_set_input_printf() works in the same way as printf, taking a format string and a variable number of arguements, then printing the results to the forms object obj, which must be an input field. flx_set_input_float() is used to display a floating-point number in an input field. The number is displayed with two digits to the right of the decimal point (ie using the format string "%.2f"). fls_set_input_int() is used to display an integer in an input field.
flx_get_input_float() reads the value of the named object as a floating-point number and returns the value. flx_get_input_int reads the value as an int. flx_enable() and flx_disable() are used to enable and disable objects. A disabled object will not receive user events. A color change is often desired to show the user that an object is or is not active. For example, the programmer may wish to grey out a button to indicate that it may not be pressed at the current time. The flx_disable() routine's lcol parameter takes a new index into the color table which will be the new color of the label. -1 indicates that the default grey-out value should be used (This value is 17 in the color table). -2 indicates that there should be no color change. flx_enable() also sets the label color of the object to the value of the lcol parameter. If lcol is -1, the label color will be set to black (color index 0). If lcol is -2, the label color of the object will not change. The routines modify the active flag in the FL_OBJECT data structure. For more information, see the FORMS documentation.
flx_findobject() looks through the given form to find an object with the given label. The routine returns NULL if no object with the given label is found. This is useful when the object pointer is needed only at a few locations in a program and may be more easily looked up than stored in a variable. In addition, programs may pass FL_FORM *'s and use flx_findobject() to look for given objects instead of passing large numbers of pointers to FL_OBJECT's.
Input fields are assumed to be no longer than 256 characters.
The formsx library does things with fields in the FORMS objects that the FORMS documentation states should be left alone. In particular, flx_findobject makes heavy use of the "first" and "last" fields of the FL_FORM data type and the "next" and "prev" fields of the FL_OBJECT data type. Using FORMS 2.0 there have been no problems so far. Caveat emptor.
Celeste Fowler email: fowler@geom.umn.edu The Geometry Center phone: (612) 626-8304 1300 South Second Street Minneapolis, MN 55454