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. The popup component is very similar to the notify component, but supports many common layouts.

For more information, see the Notify API.

Figure: Notify component

Notify component

Figure: Notify hierarchy

Notify hierarchy

Adding a Notify Component

To add a notify object, use the elm_notify_add() function:

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

Configuring the Notify Component

To configure 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 center of the parent object. The parameter has a value between 0.0 and 1.0, which means the portion of the notify component's position in the parent window. The ELM_NOTIFY_ALIGN_FILL attribute can be used to fill the notify component in each axis direction.

    elm_notify_align_set(notify, 0.5, 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 5 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");
}
Note
Except as noted, this content is licensed under LGPLv2.1+.
Go to top