Tizen Native API
5.0
|
Most of setters explained on previous examples have associated getters. That's the subject of this example. We'll add a callback to display all calendar information every time user interacts with the calendar.
Let's check our callback function:
To get selected day, we need to call elm_calendar_selected_time_get(), but to assure nothing wrong happened, we must check for function return. It'll return EINA_FALSE
if fail. Otherwise we can use time set to our structure stime
.
Next we'll get information from calendar and place on declared vars:
The only tricky part is that last line gets an array of strings (char arrays), one for each weekday.
Then we can simple print that to stdin:
struct tm
is declared on time.h
. You can check ctime
manpage to read about it.
To register this callback, that will be called every time user selects a day or goes to next or previous month, just add a callback for signal changed.
Our example will look like this:
See the full source code calendar_example_05::c here.