基本日历小部件操作代码
这段代码演示如何在一个日历小部件上创建和设置回调更改日期。void _calendar_date_changed_cb(void *data, Evas_Object * obj, void *event_info) {
struct tm selected_time;
if (!elm_calendar_selected_time_get(obj, &selected_time))
return;
//print date using logs
dlog_print(DLOG_DEBUG, LOG_TAG, "aaaa Date: %i.%i.%i", selected_time.tm_mday, selected_time.tm_mon + 1,
selected_time.tm_year + 1900);
}
void show_calendar(appdata_s *ad) {
Evas_Object *calendar = elm_calendar_add(ad->win);
evas_object_size_hint_weight_set(calendar, EVAS_HINT_EXPAND,
EVAS_HINT_EXPAND);
elm_win_resize_object_add(ad->win, calendar);
evas_object_show(calendar);
evas_object_smart_callback_add(calendar, "changed", _calendar_date_changed_cb, NULL);
}
页:
[1]