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.

  • ELM_TOOLTIP_ORIENT_NONE: Default value, Tooltip moves with mouse pointer.
  • ELM_TOOLTIP_ORIENT_TOP_LEFT: Tooltip should appear at the top left of parent.
  • ELM_TOOLTIP_ORIENT_TOP: Tooltip should appear at the top of parent.
  • ELM_TOOLTIP_ORIENT_TOP_RIGHT: Tooltip should appear at the top right of parent.
  • ELM_TOOLTIP_ORIENT_LEFT: Tooltip should appear at the left of parent.
  • ELM_TOOLTIP_ORIENT_CENTER: Tooltip should appear at the center of parent.
  • ELM_TOOLTIP_ORIENT_RIGHT: Tooltip should appear at the right of parent.
  • ELM_TOOLTIP_ORIENT_BOTTOM_LEFT: Tooltip should appear at the bottom left of parent.
  • ELM_TOOLTIP_ORIENT_BOTTOM: Tooltip should appear at the bottom of parent.
  • ELM_TOOLTIP_ORIENT_BOTTOM_RIGHT: Tooltip should appear at the bottom right of parent.
  • ELM_TOOLTIP_ORIENT_LAST: Sentinel value, don't use.

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