Tutorial

Inti Logo

« Arrows
Progress Bars »

The Tooltips Object

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.

You only need to construct one Tooltip object for a set of tooltips as it can be used to create multiple tooltips:

Tooltips();

Once you have created a new tooltip, and the widget you wish to use it on, simply use this call to set it:

void set_tip(Gtk::Widget& widget, const String& tip_text, const String& tip_private = 0);

The first argument is the widget you wish to have this tooltip pop up for, and the second the text you wish it to say. The last argument is a text string that can be used  to implement context sensitive help. For now, it is not enabled in GTK so you can just ignore it.  

Here's a short example:

Gtk::Button *button = new Gtk::Button("button 1");
.
.
Gtk::Tooltips tooltips;
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.

void enable();

Enable a disabled set of tooltips.

void disable();

Disable an enabled set of tooltips.

void unset_tip(Gtk::Widget& widget);

Unset a previously set tooltip.

And that's all the functions associated with tooltips. More than you'll ever want to know.


« Arrows Index
Miscellaneous Widgets
Top
Progress Bars »