These are the little text strings that pop up when you leave your pointer over a button or other widget for a few seconds. They are easy to use, so I will just explain them without giving an example.
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 Gtk2::Tooltips object this function returns can be used to create multiple tooltips.
$tooltip = Gtk2::Tooltips->new; |
Once you have created a new tooltip, and the widget you wish to use it on, simple use this call to set it:
Gtk2::Tooltips->set_tip($tooltips, $widget, $tip_text, $tip_private=undef); |
The first argument is the tooltip you've already created, followed by the widget you wish to have this tooltip pop up for, and the text you wish it to say. The last argument is a text string that can be used as an identifier when using Gtk2::TipsQuery to implement context sensitive help. For now, you can set it to undef.
Here's a short example:
$tooltips = Gtk2::Tooltips->new; $button = Gtk2::Button->new("button 1"); . . . $tooltips->set_tip($button, "This is button 1"); |
There are other calls that can be used with tooltips. I will just list them with a brief description of what they do.
Gtk2::Tooltips->enable($tooltips); |
Enable a disabled set of tooltips.
Gtk2::Tooltips->disable($tooltips); |
Disable an enabled set of tooltips.
And that's all the functions associated with tooltips. More than you'll ever want to know :-)