This code places 4 Elementary diskselector widgets on a window, each of them exemplifying a part of the widget's A\-P\-I.

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

The first of them is a default diskselector.  
\begin{DoxyCodeInclude}
   \textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{char} *lbl[] =
     \{
        \textcolor{stringliteral}{"Sunday"},
        \textcolor{stringliteral}{"Monday"},
        \textcolor{stringliteral}{"Tuesday"},
        \textcolor{stringliteral}{"Wednesday"},
        \textcolor{stringliteral}{"Thursday"},
        \textcolor{stringliteral}{"Friday"},
        \textcolor{stringliteral}{"Saturday"}
     \};
   ds = elm_diskselector_add(win);
   evas\_object\_size\_hint\_weight\_set(ds, EVAS\_HINT\_EXPAND, EVAS\_HINT\_EXPAND);
   evas\_object\_size\_hint\_align\_set(ds, EVAS\_HINT\_FILL, EVAS\_HINT\_FILL);
   elm_box_pack_end(bx, ds);
   \textcolor{keywordflow}{for} (i = 0; i < \textcolor{keyword}{sizeof}(lbl) / \textcolor{keyword}{sizeof}(lbl[0]); i++)
     elm_diskselector_item_append(ds, lbl[i], NULL, NULL, NULL);
   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 centeres, i.\-e., it's the selected item.\end{DoxyItemize}
To add items, we are just appending it on a loop, using function \hyperlink{group__Diskselector_gabbba9ffdb5d25c8f3de075e010bfc1b8}{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 \hyperlink{group__Diskselector_ga3590faddce462ba62930582e9cd982b1}{elm\-\_\-diskselector\-\_\-round\-\_\-enabled\-\_\-set()}.

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


\begin{DoxyCodeInclude}
   ds = elm_diskselector_add(win);
   evas\_object\_size\_hint\_weight\_set(ds, EVAS\_HINT\_EXPAND, EVAS\_HINT\_EXPAND);
   evas\_object\_size\_hint\_align\_set(ds, EVAS\_HINT\_FILL, EVAS\_HINT\_FILL);
   elm_box_pack_end(bx, ds);
   \textcolor{keywordflow}{for} (i = 0; i < \textcolor{keyword}{sizeof}(lbl) / \textcolor{keyword}{sizeof}(lbl[0]); i++)
     elm_diskselector_item_append(ds, lbl[i], NULL, NULL, NULL);
   elm_diskselector_round_enabled_set(ds, EINA\_TRUE);
   elm_diskselector_side_text_max_length_set(ds, 2);
   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 \hyperlink{group__Diskselector_gaee12cb9c62c4ae9166d71c1a6170c3df}{elm\-\_\-diskselector\-\_\-display\-\_\-item\-\_\-num\-\_\-set()}, as you can see here\-: 
\begin{DoxyCodeInclude}
   ds = elm_diskselector_add(win);
   evas\_object\_size\_hint\_weight\_set(ds, EVAS\_HINT\_EXPAND, EVAS\_HINT\_EXPAND);
   evas\_object\_size\_hint\_align\_set(ds, EVAS\_HINT\_FILL, EVAS\_HINT\_FILL);
   elm_box_pack_end(bx, ds);
   \textcolor{keywordflow}{for} (i = 0; i < \textcolor{keyword}{sizeof}(lbl) / \textcolor{keyword}{sizeof}(lbl[0]); i++)
     elm_diskselector_item_append(ds, lbl[i], NULL, NULL, NULL);
   elm_diskselector_display_item_num_set(ds, 5);

\end{DoxyCodeInclude}


\begin{DoxyNote}{Note}
You can't set less than 3 items to be displayed.
\end{DoxyNote}
You can get the number of items in the diskselector by calling \hyperlink{group__Diskselector_gac8a2b4e2ddb90dbd171bc04e700cd67f}{elm\-\_\-diskselector\-\_\-display\-\_\-item\-\_\-num\-\_\-get()}, as you can see here\-: 
\begin{DoxyCodeInclude}
   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}
   ds = elm_diskselector_add(win);
   evas\_object\_size\_hint\_weight\_set(ds, EVAS\_HINT\_EXPAND, EVAS\_HINT\_EXPAND);
   evas\_object\_size\_hint\_align\_set(ds, EVAS\_HINT\_FILL, EVAS\_HINT\_FILL);
   elm_box_pack_end(bx, ds);
   \textcolor{keywordflow}{for} (i = 0; i < \textcolor{keyword}{sizeof}(lbl) / \textcolor{keyword}{sizeof}(lbl[0]); i++)
     elm_diskselector_item_append(ds, lbl[i], NULL, NULL, NULL);
   elm_scroller_bounce_set(ds, EINA\_TRUE, EINA\_TRUE);
   elm_scroller_policy_set(ds, ELM\_SCROLLER\_POLICY\_AUTO,
                           ELM\_SCROLLER\_POLICY\_ON);
   evas\_object\_show(ds);

\end{DoxyCodeInclude}


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

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