Next: Buttons, Previous: Boxes, Up: Part I Defining Forms [Contents][Index]
A second type of object is text. Text can be placed at any place on the form in any color you like. Placing a text object is done with the routine
FL_OBJECT *fl_add_text(int type, FL_Coord x, FL_Coord y, FL_Coord w, FL_Coord h, const char *label);
where type
indicates the shape of the text. The Forms Library at
the moment supports only one type of text: FL_NORMAL_TEXT
.
The text can be placed inside a box using the routine
fl_set_object_boxtype()
to be described in Changing Attributes. Again, the text can be multi-lined or underlined by
embedding respectively the newline (\n
) or <Ctrl>H
(\010
or '\b'
) in the label. The style, size and color
of the text can be controlled and changed in many ways, see Label Attributes and Fonts.
Note that there is almost no difference between a box with a label and a text. The only difference lies in the position where the text is placed object. Text is normally placed inside the box at the left side. This helps you put different lines of text below each other. Labels inside boxes are by default centered in the box. You can change the position of the text inside the box using the routines in Label Attributes and Fonts. Note that, when not using any box around the text there is no need to specify a width and height of the box, they can both be 0.