11.2 Showing help-balloons

The library library(help_message) provides support for displaying balloons. After loading this library, a loc_still event causes the system to look for a graphical implementing the <-help_message method. If <-help_message: tag yields a string, the library shows a little window with the message. Moving the pointer out of the area of the graphical or pressing a button causes the feedback window to disappear.

This tenchnique is commonly used in modern interfaces to provide feedback on the functions behind icons. See also section 11.3.2.

In addition to registering the global event-handler, the library defines ->help_message to the classes visual, graphical and menu.

visual ->help_message: {tag,summary}, string*
Register string as tag (balloon) or extensive help message (summary) for the receiving object. At the moment summary is not used.
visual <-help_message: {tag,summary}, event
string This message is defined to return the help-message registered using ->help_message. User-defined classes may consider redefining this method to generate the help-message on-the-fly.

Here is a typical usage for this library.

:- use_module(library(help_message)).
resource(print, image, image('16x16/print.xpm')).

        send(X, append, new(B, button(print))),
        send(B, label, image(resource(print))),
        send(B, help_message, tag, 'Print document'),