

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\-: 
\begin{DoxyCodeInclude}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_print\_cal\_info\_cb(\textcolor{keywordtype}{void} *data, Evas\_Object *obj, \textcolor{keywordtype}{void} *event\_info)
\{
   \textcolor{keywordtype}{int} year\_min, year\_max;
   Eina\_Bool sel\_enabled;
   \textcolor{keyword}{const} \textcolor{keywordtype}{char} **wds;
   \textcolor{keyword}{struct }tm sel\_time;
   \textcolor{keywordtype}{double} interval;

\end{DoxyCodeInclude}


To get selected day, we need to call \hyperlink{group__Calendar_ga2755256468c7d2d2111932d148add098}{elm\-\_\-calendar\-\_\-selected\-\_\-time\-\_\-get()}, but to assure nothing wrong happened, we must check for function return. It'll return {\ttfamily E\-I\-N\-A\-\_\-\-F\-A\-L\-S\-E} if fail. Otherwise we can use time set to our structure {\ttfamily stime}. 
\begin{DoxyCodeInclude}
   \textcolor{keywordflow}{if} (!elm_calendar_selected_time_get(obj, &sel\_time))
     \textcolor{keywordflow}{return};

\end{DoxyCodeInclude}


Next we'll get information from calendar and place on declared vars\-: 
\begin{DoxyCodeInclude}
   interval = elm_calendar_interval_get(obj);
   elm_calendar_min_max_year_get(obj, &year\_min, &year\_max);
   sel\_enabled = (elm_calendar_select_mode_get(obj) != ELM\_CALENDAR\_SELECT\_MODE\_NONE);
   wds = elm_calendar_weekdays_names_get(obj);

\end{DoxyCodeInclude}


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\-: 
\begin{DoxyCodeInclude}
   printf(\textcolor{stringliteral}{"Day: %i, Mon: %i, Year %i, WeekDay: %i<br>\(\backslash\)n"}
          \textcolor{stringliteral}{"Interval: %0.2f, Year\_Min: %i, Year\_Max %i, Sel Enabled : %i<br>\(\backslash\)n"}
          \textcolor{stringliteral}{"Weekdays: %s, %s, %s, %s, %s, %s, %s<br>\(\backslash\)n\(\backslash\)n"},
          sel\_time.tm\_mday, sel\_time.tm\_mon, sel\_time.tm\_year + 1900, sel\_time.tm\_wday,
          interval, year\_min, year\_max, sel\_enabled,
          wds[0], wds[1], wds[2], wds[3], wds[4], wds[5], wds[6]);
\}

\end{DoxyCodeInclude}


{\ttfamily  struct tm } is declared on {\ttfamily time.\-h}. You can check {\ttfamily 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 {\bfseries changed}. 
\begin{DoxyCodeInclude}
   evas\_object\_smart\_callback\_add(cal, \textcolor{stringliteral}{"changed"}, \_print\_cal\_info\_cb, NULL);

\end{DoxyCodeInclude}


Our example will look like this\-:

 
\begin{DoxyImage}
\includegraphics{screenshots/calendar_example_05}
\caption{width=}
\end{DoxyImage}


See the full source code \hyperlink{calendar_example_05_8c-example}{calendar\-\_\-example\-\_\-05.\-c} here. 