This code places three Elementary Datetime widgets on a window, each of them exemplifying the widget's different usage.
The first of them is "only Date display":
#define EVAS_HINT_EXPAND
Use with evas_object_size_hint_weight_set(), evas_object_size_hint_weight_get(), evas_object_size_hin...
Definition Evas_Common.h:297
#define EVAS_HINT_FILL
Use with evas_object_size_hint_align_set(), evas_object_size_hint_align_get(), evas_object_size_hint_...
Definition Evas_Common.h:298
#define EINA_FALSE
boolean value FALSE (numerical value 0)
Definition eina_types.h:533
void elm_box_pack_end(Elm_Box *obj, Efl_Canvas_Object *subobj)
Add an object at the end of the pack list.
Definition elm_box_eo.legacy.c:57
void elm_datetime_field_visible_set(Evas_Object *obj, Elm_Datetime_Field_Type fieldtype, Eina_Bool visible)
Set a field to be visible or not.
Definition elm_datetime.c:158
Evas_Object * elm_datetime_add(Evas_Object *parent)
Adds a new datetime Widget.
Definition elm_datetime.c:40
@ ELM_DATETIME_MINUTE
Indicates Minute field.
Definition elm_datetime.h:214
@ ELM_DATETIME_AMPM
Indicates AM/PM field .
Definition elm_datetime.h:215
@ ELM_DATETIME_HOUR
Indicates Hour field.
Definition elm_datetime.h:213
EVAS_API void evas_object_show(Evas_Object *eo_obj)
Makes the given Evas object visible.
Definition evas_object_main.c:1814
EVAS_API void evas_object_size_hint_weight_set(Evas_Object *obj, double x, double y)
Sets the hints for an object's weight.
Definition evas_object_main.c:2638
EVAS_API void evas_object_size_hint_align_set(Evas_Object *obj, double x, double y)
Sets the hints for an object's alignment.
Definition evas_object_main.c:2650
For "only Time display", see the second datetime:
@ ELM_DATETIME_MONTH
Indicates Month field.
Definition elm_datetime.h:211
@ ELM_DATETIME_YEAR
Indicates Year field.
Definition elm_datetime.h:210
@ ELM_DATETIME_DATE
Indicates Date field.
Definition elm_datetime.h:212
The third one will display datetime shows both Date and Time, corresponding format will be taken from system locale. Note, besides, that the strings are different for different language settings.
Datetime format can be programmatically set by using elm_datetime_format_set():
The default format of any locale consists:
- Year Field
- Month Field
- Date Field
- Hour Field(12hr/24hr format)
- Minute Field
- AM/PM (if exists).
This is how the example program's window looks like with the datetime widget showing only date, only time and both date & time:
See the full source code for this example.