

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}
\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 elm\+\_\+calendar\+\_\+selected\+\_\+time\+\_\+get(), but to assure nothing wrong happened, we must check for function return. It\textquotesingle{}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\textquotesingle{}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{DoxyImageNoCaption}
  \mbox{\includegraphics[width=\textwidth]{screenshots/calendar_example_05}}
\end{DoxyImageNoCaption}


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