Object
+--- Data
+--- Tooltips
Tooltips are the little text strings that pop up when you leave your pointer over a button or other widget for a few seconds.
Widgets that do not receive events (widgets that do not have their own window) will not work with tooltips.
The first call you will use creates a new tooltip. You only need
to do this once for a set of tooltips as the tooltips object
this function returns can be used to create multiple tooltips.
new Gtk::Tooltips();
Once you have created a new tooltip, and the widget you wish to
use it on, simply use this call to set it:
$tooltips->set_tip( $widget, $tip_text, $tip_private );
The first argument is the the widget you wish to have this
tooltip pop up for, and the next is the text you wish it to
say. The last argument is a text string that can be used as an
identifier when using the GTK TipsQuery widget to implement
context sensitive help. For now, you can leave it blank.
Here's a short example:
$button = new Gtk::Button( "Button" );
$tooltips = new Gtk::Tooltips();
$tooltps->set_tip( $button, "This is the button", "" );
There are other calls that can be used with tooltips. I will just list them with a brief description of what they do.
To enable or disabled a set of tooltips:
$tooltips->enable();
$tooltips->disable();
To set how many
milliseconds
you have to hold the mouse pointer over the widget before the
tooltip will pop up:
$tooltips->set_delay( $delay );
The default delay is 500 milliseconds (half a second).
Finally, you can set the foreground and background color of the
tooltip using:
$tooltips->set_colors( $background, $foreground );
And that's all the functions associated with tooltips. More than you'll ever want to know :-)