All Manuals > CAPI User Guide and Reference Manual > 3 General Properties of CAPI Panes

3.12 Tooltips

A tooltip is a temporary window containing text which appears when the user positions the cursor over an element for a period. The appearance is slightly delayed and the text is usually short.

Tooltips are often used for brief help text and identification of GUI elements. For example the "X" button alongside the Filter area in the Process Browser tool in the LispWorks IDE has a tooltip "Clear filter". Tooltips can also be used to complete the display of partially hidden text, for example in the Debugger tool Backtrace view where the display of long variable values might be truncated.

You can implement tooltips for output-panes, collections, elements, menu-items and toolbar-buttons.

3.12.1 Tooltips for output panes

To implement tooltips in an output-pane, call display-tooltip via a :motion gesture in the pane's input-model. The tooltip text might depend on the cursor position or, in the case of a pinboard-layout, on the pinboard object under the cursor.

See this example:

(example-edit-file "capi/graphics/pinboard-help")

3.12.2 Tooltips for collections, elements and menu items

Supply the :help-callback initarg in an interface, along with a suitable :help-key initarg for each of its collections, elements and menu-items that should have a tooltip. help-callback should return a suitable string (which will be the tooltip text) when passed type :tooltip and the help-key.

See the manual page for interface for an example of a tooltip on a text-input-pane.

3.12.3 Tooltips for toolbar buttons

You can implement tooltips for a toolbar-button exactly as for collections and so on as described in 3.12.2 Tooltips for collections, elements and menu items. See the example in 9.5 Specifying tooltips for toolbar buttons.

However, if your toolbar-buttons are grouped in a toolbar-component it is simpler to supply the :tooltips initarg. tooltips should be a list containing a string giving the tooltip text of each button in the component. See this example:

(example-edit-file "capi/applications/simple-symbol-browser")

CAPI User Guide and Reference Manual (Unix version) - 01 Dec 2021 19:32:31