This code places 4 Elementary diskselector widgets on a window, each of them exemplifying a part of the widget\textquotesingle{}s A\+PI.

All of them will have weekdays as items, since we won\textquotesingle{}t focus on items management on this example. For an example about this subject, check \mbox{\hyperlink{diskselector_example_02}{Diskselector -\/ Items management}}.

The first of them is a default diskselector.  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{   \textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{char} *lbl[] =}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        \textcolor{stringliteral}{"Sunday"},}
\DoxyCodeLine{        \textcolor{stringliteral}{"Monday"},}
\DoxyCodeLine{        \textcolor{stringliteral}{"Tuesday"},}
\DoxyCodeLine{        \textcolor{stringliteral}{"Wednesday"},}
\DoxyCodeLine{        \textcolor{stringliteral}{"Thursday"},}
\DoxyCodeLine{        \textcolor{stringliteral}{"Friday"},}
\DoxyCodeLine{        \textcolor{stringliteral}{"Saturday"}}
\DoxyCodeLine{     \};}
\DoxyCodeLine{   ds = \mbox{\hyperlink{group__Elm__Diskselector_gaaac1076ac837e57633d7f3c068c3205b}{elm\_diskselector\_add}}(win);}
\DoxyCodeLine{   evas\_object\_size\_hint\_weight\_set(ds, \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}}, \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}});}
\DoxyCodeLine{   evas\_object\_size\_hint\_align\_set(ds, \mbox{\hyperlink{Evas__Common_8h_aecbac710f36d52911fc34dcdaf8e729c}{EVAS\_HINT\_FILL}}, \mbox{\hyperlink{Evas__Common_8h_aecbac710f36d52911fc34dcdaf8e729c}{EVAS\_HINT\_FILL}});}
\DoxyCodeLine{   elm\_box\_pack\_end(bx, ds);}
\DoxyCodeLine{   \textcolor{keywordflow}{for} (i = 0; i < \textcolor{keyword}{sizeof}(lbl) / \textcolor{keyword}{sizeof}(lbl[0]); i++)}
\DoxyCodeLine{     elm\_diskselector\_item\_append(ds, lbl[i], NULL, NULL, NULL);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(ds);}

\end{DoxyCodeInclude}


We are just adding the diskselector, so as you can see, defaults for it are\+: \begin{DoxyItemize}
\item Only 3 items visible each time. \item Only 3 characters are displayed for labels on side positions. \item The first added item remains centered, i.\+e., it\textquotesingle{}s the selected item.\end{DoxyItemize}
To add items, we are just appending it on a loop, using function elm\+\_\+diskselector\+\_\+item\+\_\+append(), that will be better explained on items management example.

For a circular diskselector, check the second widget. A circular diskselector will display first item after last, and last previous to the first one. So, as you can see, {\bfseries{Sa}} will appears on left side of selected {\bfseries{Sunday}}. This property is set with elm\+\_\+diskselector\+\_\+round\+\_\+enabled\+\_\+set().

Also, we decide to display only 2 character for side labels, instead of 3. For this we call elm\+\_\+diskselector\+\_\+side\+\_\+text\+\_\+max\+\_\+length\+\_\+set(). As result, we\textquotesingle{}ll see {\bfseries{Mo}} displayed instead of {\bfseries{Mon}}, when {\bfseries{Monday}} is on a side position.


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{   ds = \mbox{\hyperlink{group__Elm__Diskselector_gaaac1076ac837e57633d7f3c068c3205b}{elm\_diskselector\_add}}(win);}
\DoxyCodeLine{   evas\_object\_size\_hint\_weight\_set(ds, \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}}, \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}});}
\DoxyCodeLine{   evas\_object\_size\_hint\_align\_set(ds, \mbox{\hyperlink{Evas__Common_8h_aecbac710f36d52911fc34dcdaf8e729c}{EVAS\_HINT\_FILL}}, \mbox{\hyperlink{Evas__Common_8h_aecbac710f36d52911fc34dcdaf8e729c}{EVAS\_HINT\_FILL}});}
\DoxyCodeLine{   elm\_box\_pack\_end(bx, ds);}
\DoxyCodeLine{   \textcolor{keywordflow}{for} (i = 0; i < \textcolor{keyword}{sizeof}(lbl) / \textcolor{keyword}{sizeof}(lbl[0]); i++)}
\DoxyCodeLine{     elm\_diskselector\_item\_append(ds, lbl[i], NULL, NULL, NULL);}
\DoxyCodeLine{   elm\_diskselector\_round\_enabled\_set(ds, \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});}
\DoxyCodeLine{   elm\_diskselector\_side\_text\_max\_length\_set(ds, 2);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(ds);}

\end{DoxyCodeInclude}


But so far, we are only displaying 3 items at once. If more are wanted, is enough to call elm\+\_\+diskselector\+\_\+display\+\_\+item\+\_\+num\+\_\+set(), as you can see here\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{   ds = \mbox{\hyperlink{group__Elm__Diskselector_gaaac1076ac837e57633d7f3c068c3205b}{elm\_diskselector\_add}}(win);}
\DoxyCodeLine{   evas\_object\_size\_hint\_weight\_set(ds, \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}}, \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}});}
\DoxyCodeLine{   evas\_object\_size\_hint\_align\_set(ds, \mbox{\hyperlink{Evas__Common_8h_aecbac710f36d52911fc34dcdaf8e729c}{EVAS\_HINT\_FILL}}, \mbox{\hyperlink{Evas__Common_8h_aecbac710f36d52911fc34dcdaf8e729c}{EVAS\_HINT\_FILL}});}
\DoxyCodeLine{   elm\_box\_pack\_end(bx, ds);}
\DoxyCodeLine{   \textcolor{keywordflow}{for} (i = 0; i < \textcolor{keyword}{sizeof}(lbl) / \textcolor{keyword}{sizeof}(lbl[0]); i++)}
\DoxyCodeLine{     elm\_diskselector\_item\_append(ds, lbl[i], NULL, NULL, NULL);}
\DoxyCodeLine{   elm\_diskselector\_display\_item\_num\_set(ds, 5);}

\end{DoxyCodeInclude}


\begin{DoxyNote}{Note}
You can\textquotesingle{}t set less than 3 items to be displayed.
\end{DoxyNote}
You can get the number of items in the diskselector by calling elm\+\_\+diskselector\+\_\+display\+\_\+item\+\_\+num\+\_\+get(), as you can see here\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"Number of Items in DiskSelector : \%d\(\backslash\)n"}, elm\_diskselector\_display\_item\_num\_get(ds));}

\end{DoxyCodeInclude}


Finally, if a bounce effect is required, or you would like to see scrollbars, it is possible. But, for default theme, diskselector scrollbars will be invisible anyway. 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{   ds = \mbox{\hyperlink{group__Elm__Diskselector_gaaac1076ac837e57633d7f3c068c3205b}{elm\_diskselector\_add}}(win);}
\DoxyCodeLine{   evas\_object\_size\_hint\_weight\_set(ds, \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}}, \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}});}
\DoxyCodeLine{   evas\_object\_size\_hint\_align\_set(ds, \mbox{\hyperlink{Evas__Common_8h_aecbac710f36d52911fc34dcdaf8e729c}{EVAS\_HINT\_FILL}}, \mbox{\hyperlink{Evas__Common_8h_aecbac710f36d52911fc34dcdaf8e729c}{EVAS\_HINT\_FILL}});}
\DoxyCodeLine{   elm\_box\_pack\_end(bx, ds);}
\DoxyCodeLine{   \textcolor{keywordflow}{for} (i = 0; i < \textcolor{keyword}{sizeof}(lbl) / \textcolor{keyword}{sizeof}(lbl[0]); i++)}
\DoxyCodeLine{     elm\_diskselector\_item\_append(ds, lbl[i], NULL, NULL, NULL);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Scroller_gae69101dbdb089598ca790c73bd9d7a42}{elm\_scroller\_bounce\_set}}(ds, \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}}, \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Scroller_ga4105c0d6adca64ed3d38e7e4116b09e4}{elm\_scroller\_policy\_set}}(ds, \mbox{\hyperlink{group__Elm__Scroller_ggae4532876fde43d8d37fc9440a1e36a84a9a3e639489c64f070d4caa6cafc22870}{ELM\_SCROLLER\_POLICY\_AUTO}},}
\DoxyCodeLine{                           \mbox{\hyperlink{group__Elm__Scroller_ggae4532876fde43d8d37fc9440a1e36a84a74e67e8e341f5069ec27244c2a41053f}{ELM\_SCROLLER\_POLICY\_ON}});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(ds);}

\end{DoxyCodeInclude}


See the full \mbox{\hyperlink{diskselector_example_01_8c-example}{diskselector\+\_\+example\+\_\+01.c}} code, whose window should look like this picture\+:

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