Label Widgets

The label widget displays text with simple html-like markup.

Table of Contents

Adding a Label

To add a label and set the text in it, use the following functions.

Evas_Object *label = elm_label_add(win);
elm_object_text_set(label, "Some long text for our label, that is not so long");

Using Label Styles

Label displays the text with several predefined styles.

  • default - No animation
  • marker - Centers the text in the label and makes it bold by default
  • slide_long - The entire text appears from the right of the screen and slides until it disappears in the left of the screen(reappearing on the right again).
  • slide_short - The text appears in the left of the label and slides to the right to show the overflow. When all of the text has been shown the position is reset.
  • slide_bounce - The text appears in the left of the label and slides to the right to show the overflow. When all of the text has been shown the animation reverses, moving the text to the left.

Here we set the style to “slide_long”.

elm_object_style_set(label, "slide_long");

Configuring the Label

The duration of the animation and the slide mode can be set.

elm_label_slide_duration_set(label, 3);
elm_label_slide_mode_set(label, ELM_LABEL_SLIDE_MODE_ALWAYS);

The style can be modified.

elm_object_style_set(label, "slide_bounce");

Using Label Callbacks

This widget emits the following signals, besides the ones sent from Layout:

  • “language,changed”: The program's language changes.
  • “slide,end”: The slide reaches the end.

Here we register a callback on the “slide,end” signal.

evas_object_smart_callback_add(label, "slide,end", _slide_end_cb, data);
// Callback function for the "slide,end" signal
// This callback is called when the label slide reaches the end
static void
_slide_end_cb(void *data, Evas_Object *obj, void *event_info)
{
   printf("Slide has reach the end.\n");
}


A Label Example