Mobile native

Notify

This feature is supported in mobile applications only.

The notify component displays a container in a particular region of the parent object. It can receive some content, and can be automatically hidden after a certain amount of time.

Figure: Notify hierarchy

Notify hierarchy

Adding a Notify Component

The following example shows how to create a notify object.

Evas_Object *notify, *parent;
notify = elm_notify_add(parent);

Configuring the Notify Component

Create a label and add it to the notify object.

Evas_Object *content;

// Create the label and set some text to it 
content = elm_label_add(parent);

elm_object_text_set(content, "A label text");
evas_object_show(content);

// Add the label object to the notify component
elm_object_content_set(notify, content);

In the following example the notify object is shown on the bottom left corner of the parent object.

elm_notify_align_set(notify, 1.0, 1.0);
evas_object_show(notify);

Set a timeout interval, after which the notify component is hidden. In the following example the timeout interval is five seconds.

elm_notify_timeout_set(notify, 5.0);

Using Notify Callbacks

The notify component emits the following signals:

  • timeout: The timeout count ends and the notify component is hidden
  • block,clicked: The user clicks outside of the notify component

For both these signals event_info is NULL.

The following example shows how to register a callback on the timeout signal.

{
   evas_object_smart_callback_add(notify, "timeout", timeout_cb, data);
}

// Callback function for the "timeout" signal
// The timeout expires and the notify object is hidden
 
void timeout_cb(void *data, Evas_Object *obj, void *event_info)
{
   dlog_print(DLOG_INFO, LOG_TAG, "Notify is hidden\n");
}
Go to top