Wearable native

Datetime

This feature is supported in wearable applications only.

The datetime component displays and adds date and time values.

Figure: Datetime selection

Datetime selection

Figure: Datetime hierarchy

Datetime hierarchy

Adding a Datetime Component

The UI component is created with elm_datetime_add().

The following fields can be controlled:

  • ELM_DATETIME_YEAR: the year field
  • ELM_DATETIME_MONTH: the month field
  • ELM_DATETIME_DATE: the date field
  • ELM_DATETIME_HOUR: the hour field
  • ELM_DATETIME_MINUTE: the minute field
  • ELM_DATETIME_AMPM: the AM/PM field

Using the Datetime Styles

The following styles are available:

  • datepicker_layout
  • timepicker_layout

The following example creates the datepicker_layout style:

elm_object_style_set(datetime, "datepicker_layout");

Setting the Datetime Format

The format of the date and time can be configured with elm_datetime_format_set() using a combination of allowed Libc date format specifiers. In the following example the format is set to HH : MM.

elm_object_style_set(datetime, "timepicker_layout");
elm_datetime_format_set(datetime, "%d/%b/%Y%I:%M");

Please refer to the API documentation for a complete list of all the options available.

Using the Datetime Callbacks

A callback can be registered on the changed signal to detect when the Datetime field values are changed. The event_info parameter is NULL.

{
   evas_object_smart_callback_add(datetime, "changed", changed_cb, data);
}

// Callback function for the "changed" signal
// This callback is called when the datetime fields change
void changed_cb(void *data, Evas_Object *obj, void *event_info)
{
   dlog_print(DLOG_INFO, LOG_TAG, "Datetime field changed. \n");
}

The language,changed signal is emitted when the system locale changes.

Go to top