Tool Tips (XForms (Forms Library) - Version 1.2 (Rev. 4) A Graphical User Interface Toolkit for X)

Next: Redrawing, Previous: Label Attributes and Fonts, Up: Changing Attributes [Contents][Index]

#### 3.11.4 Tool Tips

As will be seen later, an object can be decorated by icons instead of labels. For this kind of object, it is helpful to show a text string that explains the function the object controls under appropriate conditions. Forms Library elected to show the message after the mouse enters the object for about 600 milli-seconds. The text is removed when the mouse leaves the object or when the mouse is pressed.

To set the text, use the following routines

    void fl_set_object_helper(FL_OBJECT *obj, const char *helpmsg);
    void fl_set_object_helper_f(FL_OBJECT *obj, const char *fmt, ...);

where `helpmsg` is a text string (with possible embedded newlines in it) that will be shown when the mouse enters the object, after about a 600 milli-second delay. The second form of the function accepts instead a format string like `printf()` etc., followed by the appropriate number of arguments. In both cases an internal copy of the string is made.

The boxtype, color and font for the message display can be customized further using the following routines

    void fl_set_tooltip_boxtype(int boxtype);
    void fl_set_tooltip_color(FL_COLOR textcolor, FL_COLOR background);
    void fl_set_tooltip_font(int style, int size);
    void fl_set_tooltip_lalign(int align);

where `boxtype` is the backface of the form that displays the text. The default is `FL_BORDER_BOX`. `textcolor` and `background` specify the colors of the text string and the backface. The defaults for these are `FL_BLACK` and `FL_YELLOW` respectively. The `style` and `size` parameters are the font style and size of the text. `align` is the alignment of the text string with respective to the box. The default is `FL_ALIGN_LEFT | FL_ALIGN_INSIDE` .

Next: Redrawing, Previous: Label Attributes and Fonts, Up: Changing Attributes [Contents][Index]