Calendar - Days selection.

It's possible to disable date selection and to select a date from your program, and that's what we'll see on this example.

If isn't required that users could select a day on calendar, only interacting going through months, disabling days selection could be a good idea to avoid confusion. For that:

elm_calendar_select_mode_set(cal, ELM_CALENDAR_SELECT_MODE_NONE);

Also, regarding days selection, you could be interested to set a date to be highlighted on calendar from your code, maybe when a specific event happens, or after calendar creation. As time output is in seconds, we define the number of seconds contained within a day as a constant:

#define SECS_DAY 86400

Now let's select two days from current day:

current_time = time(NULL) + 2 * SECS_DAY;
localtime_r(&current_time, &selected_time);
elm_calendar_selected_time_set(cal2, &selected_time);

Our example will look like this:

calendar_example_04.png

See the full source code calendar_example_04.c here.