Mobile native

Label

This feature is supported in mobile applications only.

The label component displays text with a simple html-like markup.

For more information, see the Label API.

Figure: Label component

Label component

Figure: Label hierarchy

Label hierarchy

Adding a Label Component

To add a label and set the text in it:

Evas_Object *label = elm_label_add(win);

elm_object_text_set(label, "Some long text for our label, that is not so long");

Using the Label Styles

Label displays the text with the following predefined styles:

  • default: No animation
  • marker: The text is centered and bolded.
  • slide_long: The 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.

In the following example, the style is set to slide_long.

elm_object_style_set(label, "slide_long");

Configuring the Label

To configure the label:

  1. Set the duration of the animation and the slide mode:

    elm_label_slide_duration_set(label, 3);
    elm_label_slide_mode_set(label, ELM_LABEL_SLIDE_MODE_ALWAYS);
    
  2. Modify the style:

    elm_object_style_set(label, "slide_bounce");
    

Using the Label Callbacks

The label component emits the following signals:

  • language,changed: The program's language changes.
  • slide,end: The slide reaches the end.
  • anchor,clicked: The anchor is clicked. event_info points to an object of the type Elm_Label_Anchor_Info.
  • anchor,mouse,down event_info points to an object of the type Elm_Label_Anchor_Info.
  • anchor,mouse,up event_info points to an object of the type Elm_Label_Anchor_Info.

The following example registers 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
void 
slide_end_cb(void *data, Evas_Object *obj, void *event_info)
{
   dlog_print(DLOG_INFO, LOG_TAG, "Slide has reach the end.\n");
}
Note
Except as noted, this content is licensed under LGPLv2.1+.
Go to top