1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-28 07:03:00 +08:00

lv_calendar_get_pressed_date: return NULL if not date pressed

This commit is contained in:
Gabor Kiss-Vamosi 2019-07-26 13:23:19 +02:00
parent a4c6d511b7
commit 3cfe72c0fb
2 changed files with 3 additions and 1 deletions

View File

@ -317,11 +317,12 @@ lv_calendar_date_t * lv_calendar_get_showed_date(const lv_obj_t * calendar)
* Get the the pressed date.
* @param calendar pointer to a calendar object
* @return pointer to an `lv_calendar_date_t` variable containing the pressed date.
* `NULL` if not date pressed (e.g. the header)
*/
lv_calendar_date_t * lv_calendar_get_pressed_date(const lv_obj_t * calendar)
{
lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar);
return &ext->pressed_date;
return ext->pressed_date.year != 0 ? &ext->pressed_date : NULL;
}
/**

View File

@ -172,6 +172,7 @@ lv_calendar_date_t * lv_calendar_get_showed_date(const lv_obj_t * calendar);
* Get the the pressed date.
* @param calendar pointer to a calendar object
* @return pointer to an `lv_calendar_date_t` variable containing the pressed date.
* `NULL` if not date pressed (e.g. the header)
*/
lv_calendar_date_t * lv_calendar_get_pressed_date(const lv_obj_t * calendar);