Table of Contents

Widgets Menu


Tooltips Widgets

The tooltip widget is a smart object that shows a content in a frame when mouse hovers a parent object. The widget provides tips or information about the parent object.

Table of Contents

Adding a Tooltips

The tooltip widget cannot be created with the elm_tooltip_add() function. This widget is already contained in a widget when it is created. We can only activate or disable it.

Activating the Tooltip

To activate the tooltip on a parent object, we can set a tooltip text to the parent object,

elm_object_tooltip_text_set(parent, "The tooltip text");

or set a content to the parent object.

elm_object_tooltip_content_cb_set(parent,
                                  tooltip_content_cb,
                                  NULL,
                                  tooltip_content_del_cb);
Evas_Object*
tooltip_content_cb(void*data, Evas_Object *obj, Evas_Object *tooltip)
{
   // Create the tooltip content
}
 
static void
tooltip_content_del_cb(void *data, Evas_Object *obj, void *event_info)
{
   // Destroy the tooltip content
}

When passing content to the tooltip, the tooltip_content_cb function is called each time the tooltip is showed. The role of this function is to create the content to set in the tooltip. It returns a pointer to an Evas_Object.

When the tooltip disappears, the tooltip_content_del_cb function is called. This function is in charge of deleting the previously allocated Evas_Object.

Once set, the tooltip can be manually hidden or shown.

elm_object_tooltip_hide(parent);
elm_object_tooltip_show(parent);

The tooltip can be removed from the parent object when it is not needed.

elm_object_tooltip_unset(parent);
When content is set into the tooltip object, unsetting it calls the callback provided as del_cb to notify that the tooltip cannot be used any longer.

Configuring Tooltip

Set the orientation of the tooltip widget relative to its parent. By default, ELM_TOOLTIP_ORIENT_NONE is set.

A tooltip object is not a widget, so it does not emit signals. There are no registered callbacks for it.


Widgets Menu