Next: , Previous: , Up: Changing Attributes   [Contents][Index]


3.11.2 Bounding Boxes

Each object has a bounding box. This bounding box can have different shapes. For boxes it is determined by the type. For text it is normally not visible. For input fields it normally is a FL_DOWN_BOX, etc. The shape of the box can be changed using the routine

void fl_set_object_boxtype(FL_OBJECT *obj, int boxtype);

boxtype should be one of the following: FL_UP_BOX, FL_DOWN_BOX, FL_FLAT_BOX, FL_BORDER_BOX, FL_SHADOW_BOX, FL_ROUNDED_BOX, FL_RFLAT_BOX, FL_RSHADOW_BOX and FL_NO_BOX, with the same meaning as the type for boxes. Some care has to be taken when changing boxtypes. In particular, for objects like sliders, input fields, etc. never use the boxtype FL_NO_BOX. Don’t change the boxtype of objects that are visible on the screen. It might have undesirable effects. If you must do so, redraw the entire form after changing the boxtype of an object (see below). See the program boxtype.c for the effect of the boxtype on the different classes of objects.

It is possible to alter the appearance of an object by changing the border width attribute

void fl_set_object_bw(FL_OBJECT *obj, int bw);

To find out about the current setting for the border width of an object call

int fl_get_object_bw(FL_OBJECT *obj);

Border width controls the "height" of an object, e.g., a button having a border width of 3 pixels appears more pronounced than one having a border width of 2. The Forms Library’s default is FL_BOUND_WIDTH (1) pixels (before version 1.0.91 the default was 3). Note that the border width can be negative. Negative border width does not make a down box, rather, it makes the object having an upbox appear less pronounced and "softer". See program borderwidth.c for the effect of border width on different objects. All applications developed using XForms accept a command line option ‘-bw’, followed by an integer number, the user can use to select the preferred border width. It is recommended that you document this flag in your application documentation. If you prefer a certain border width, use fl_set_defaults() or fl_set_border_width() before fl_initialize() to set the border width instead of hard-coding it on a per form or per object basis so the user has the option to change it at run time via the ‘-bw’ flag.

xforms_images/borderwidth

There also exists a call that changes the object border width for the entire application

void fl_set_border_width(int border_width);

Next: , Previous: , Up: Changing Attributes   [Contents][Index]