Tooltips

subject_field->create_tooltip("A brief title");

// ...

text_field->create_tooltip("A brief message, a few lines long.", 30);

inputfieldsandbuttons.C gives an example of creating tooltips. A tooltip is a small popup window that appears when the pointer gets positioned on top of a display element and doesn't move for a few seconds. The tooltip popup appears next to the pointer and goes away automatically when the pointer moves again.

Tooltip text should be small. The tooltip gets positioned above and to the right of the pointer by default. If the pointer is near the edge of the screen the tooltip may get repositioned so that its entire contents are visible.

The first parameter to create_tooltip() is actually a x::w::text_param object. This allows custom fonts and text colors for the tooltip. The tooltip's background color is fixed by the current theme. An optional second parameter specifies the tooltip's width in millimeters. The tooltip's gext gets word-wrapped to fit within the given width. The tooltip's text does not get word-wrapped otherwise, but may contain '\n's to introduce explicit line breaks.