

Most of setters explained on previous examples have associated getters. That\textquotesingle{}s the subject of this example. We\textquotesingle{}ll add a callback to display all calendar information every time user interacts with the calendar.

Let\textquotesingle{}s check our callback function\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_print\_cal\_info\_cb(\textcolor{keywordtype}{void}\ *data\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},\ \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}\ *obj,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ *event\_info\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{int}\ year\_min,\ year\_max;}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}\ sel\_enabled;}
\DoxyCodeLine{\ \ \ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ **wds;}
\DoxyCodeLine{\ \ \ \textcolor{keyword}{struct\ }tm\ sel\_time;}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{double}\ interval;}

\end{DoxyCodeInclude}
 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\textquotesingle{}ll return {\ttfamily EINA\+\_\+\+FALSE} if fail. Otherwise we can use time set to our structure {\ttfamily stime}. 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (!elm\_calendar\_selected\_time\_get(obj,\ \&sel\_time))}
\DoxyCodeLine{\ \ \ \ \ \textcolor{keywordflow}{return};}

\end{DoxyCodeInclude}
 Next we\textquotesingle{}ll get information from calendar and place on declared vars\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\ \ \ interval\ =\ elm\_calendar\_interval\_get(obj);}
\DoxyCodeLine{\ \ \ elm\_calendar\_min\_max\_year\_get(obj,\ \&year\_min,\ \&year\_max);}
\DoxyCodeLine{\ \ \ sel\_enabled\ =\ (elm\_calendar\_select\_mode\_get(obj)\ !=\ ELM\_CALENDAR\_SELECT\_MODE\_NONE);}
\DoxyCodeLine{\ \ \ 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}{0}
\DoxyCodeLine{\ \ \ printf(\textcolor{stringliteral}{"{}Day:\ \%i,\ Mon:\ \%i,\ Year\ \%i,\ WeekDay:\ \%i<br>\(\backslash\)n"{}}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}Interval:\ \%0.2f,\ Year\_Min:\ \%i,\ Year\_Max\ \%i,\ Sel\ Enabled\ :\ \%i<br>\(\backslash\)n"{}}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}Weekdays:\ \%s,\ \%s,\ \%s,\ \%s,\ \%s,\ \%s,\ \%s<br>\(\backslash\)n\(\backslash\)n"{}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ sel\_time.tm\_mday,\ sel\_time.tm\_mon,\ sel\_time.tm\_year\ +\ 1900,\ sel\_time.tm\_wday,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ interval,\ year\_min,\ year\_max,\ sel\_enabled,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ wds[0],\ wds[1],\ wds[2],\ wds[3],\ wds[4],\ wds[5],\ wds[6]);}
\DoxyCodeLine{\}}

\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}{0}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Smart__Object__Group_gac12dd6655f488cc47ce6cf00eb7d12b2}{evas\_object\_smart\_callback\_add}}(cal,\ \textcolor{stringliteral}{"{}changed"{}},\ \_print\_cal\_info\_cb,\ NULL);}

\end{DoxyCodeInclude}
 Our example will look like this\+:

 
\begin{DoxyImageNoCaption}
  \mbox{\includegraphics[width=\textwidth]{screenshots/calendar_example_05}}
\end{DoxyImageNoCaption}


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