

In this example we will create 4 radio buttons, three of them in a group and another one not in the group. We will also have the radios in the group change the value of a variable directly and have then print it when the value changes. The fourth button is in the example just to make clear that radios outside the group don\textquotesingle{}t affect the group.

We\textquotesingle{}ll start with the usual includes\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{preprocessor}{\#include\ <Elementary.h>}}

\end{DoxyCodeInclude}
 And move right to declaring a static variable(the one whose value the radios will change)\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{int}\ val\ =\ 1;}

\end{DoxyCodeInclude}
 We now need to have a window and all that good stuff to be able to place our radios in\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{void}\ \_cb(\textcolor{keywordtype}{void}\ *data,\ \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}\ *obj,\ \textcolor{keywordtype}{void}\ *event\_info);}
\DoxyCodeLine{}
\DoxyCodeLine{EAPI\_MAIN\ \textcolor{keywordtype}{int}}
\DoxyCodeLine{elm\_main(\textcolor{keywordtype}{int}\ argc\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},\ \textcolor{keywordtype}{char}\ **argv\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}\ *win,\ *bx,\ *radio,\ *group,\ *ic;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__General_ga7a05f37fd3a019da5e26c5fc91fcd937}{elm\_policy\_set}}(\mbox{\hyperlink{group__Elm__General_ggaa16f3378ecdbf660fa378402e3c5a0a9a02fadb6faada04b19d0fa42c11a8d32a}{ELM\_POLICY\_QUIT}},\ \mbox{\hyperlink{group__Elm__General_gga46af37e6ac2c406321060be827117196abbe0962d88ae12afe1a173da881f56cd}{ELM\_POLICY\_QUIT\_LAST\_WINDOW\_CLOSED}});}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ win\ =\ \mbox{\hyperlink{group__Elm__Win__Group_ga23d9d1ffa0a65a1a1dd482d570db1ba0}{elm\_win\_util\_standard\_add}}(\textcolor{stringliteral}{"{}radio"{}},\ \textcolor{stringliteral}{"{}Radio"{}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Win__Group_ga9a16a2f8c9fd5b6e9203ed9dcb53ea8b}{elm\_win\_autodel\_set}}(win,\ \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ bx\ =\ \mbox{\hyperlink{group__Elm__Box__Group_ga49ec615c90bf8bead2158d5ffab2e445}{elm\_box\_add}}(win);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Box__Group_ga447f790a64a49b477019938dc3d5c3ff}{elm\_box\_horizontal\_set}}(bx,\ \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9379629ad8ad2860aa786d838a4a106a}{evas\_object\_size\_hint\_weight\_set}}(bx,\ \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}},\ \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Win__Group_ga505d6bd217e5ee01e82b548ec35986eb}{elm\_win\_resize\_object\_add}}(win,\ bx);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(bx);}

\end{DoxyCodeInclude}
 And now we create a radio button, since this is the first button in our group we set the group to be the radio(so we can set the other radios in the same group). We also set the state value of this radio to 1 and the value pointer to {\ttfamily val}, since val is {\ttfamily 1} this has the additional effect of setting the radio value to {\ttfamily 1}. For this radio we choose the default home icon\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ group\ =\ radio\ =\ \mbox{\hyperlink{group__Elm__Radio__Group_ga55ac57f03ef5a581b1fee0dce02961d2}{elm\_radio\_add}}(win);}
\DoxyCodeLine{\ \ \ elm\_object\_text\_set(radio,\ \textcolor{stringliteral}{"{}Radio\ 1"{}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Radio__Group_gac67d20c6bccac5b1ed81cddd76880235}{elm\_radio\_state\_value\_set}}(radio,\ 1);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Radio__Group_gae96fc2cfbb4c864641eb997a96dfa6e4}{elm\_radio\_value\_pointer\_set}}(radio,\ \&val);}
\DoxyCodeLine{\ \ \ ic\ =\ \mbox{\hyperlink{group__Elm__Icon_gac369f2d67be417e5cff81e8f001ff326}{elm\_icon\_add}}(win);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Icon_gab764b4c6c90543f254c013eff6a6db66}{elm\_icon\_standard\_set}}(ic,\ \textcolor{stringliteral}{"{}home"{}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__General_ga0531ec8867c72def7c780601764ca642}{elm\_object\_part\_content\_set}}(radio,\ \textcolor{stringliteral}{"{}icon"{}},\ ic);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Box__Group_ga66a10dd861578521af2ab7b8c2ca65c5}{elm\_box\_pack\_end}}(bx,\ radio);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9379629ad8ad2860aa786d838a4a106a}{evas\_object\_size\_hint\_weight\_set}}(radio,\ \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}},\ \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_gaaf1d3e26e36b316977336066b6f56632}{evas\_object\_size\_hint\_align\_set}}(radio,\ \mbox{\hyperlink{Evas__Common_8h_aecbac710f36d52911fc34dcdaf8e729c}{EVAS\_HINT\_FILL}},\ \mbox{\hyperlink{Evas__Common_8h_aecbac710f36d52911fc34dcdaf8e729c}{EVAS\_HINT\_FILL}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(radio);}

\end{DoxyCodeInclude}
 To check that our radio buttons are working we\textquotesingle{}ll add a callback to the \char`\"{}changed\char`\"{} signal of the radio\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Smart__Object__Group_gac12dd6655f488cc47ce6cf00eb7d12b2}{evas\_object\_smart\_callback\_add}}(radio,\ \textcolor{stringliteral}{"{}changed"{}},\ \_cb,\ NULL);}

\end{DoxyCodeInclude}
 The creation of our second radio button is almost identical, the 2 differences worth noting are, the value of this radio 2 and that we add this radio to the group of the first radio\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ radio\ =\ \mbox{\hyperlink{group__Elm__Radio__Group_ga55ac57f03ef5a581b1fee0dce02961d2}{elm\_radio\_add}}(win);}
\DoxyCodeLine{\ \ \ elm\_object\_text\_set(radio,\ \textcolor{stringliteral}{"{}Radio\ 2"{}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Radio__Group_gac67d20c6bccac5b1ed81cddd76880235}{elm\_radio\_state\_value\_set}}(radio,\ 2);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Radio__Group_gae96fc2cfbb4c864641eb997a96dfa6e4}{elm\_radio\_value\_pointer\_set}}(radio,\ \&val);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Radio__Group_gaa597f8aaad338c0221dada51ac7e110f}{elm\_radio\_group\_add}}(radio,\ group);}
\DoxyCodeLine{\ \ \ ic\ =\ \mbox{\hyperlink{group__Elm__Icon_gac369f2d67be417e5cff81e8f001ff326}{elm\_icon\_add}}(win);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Icon_gab764b4c6c90543f254c013eff6a6db66}{elm\_icon\_standard\_set}}(ic,\ \textcolor{stringliteral}{"{}file"{}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__General_ga0531ec8867c72def7c780601764ca642}{elm\_object\_part\_content\_set}}(radio,\ \textcolor{stringliteral}{"{}icon"{}},\ ic);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Box__Group_ga66a10dd861578521af2ab7b8c2ca65c5}{elm\_box\_pack\_end}}(bx,\ radio);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9379629ad8ad2860aa786d838a4a106a}{evas\_object\_size\_hint\_weight\_set}}(radio,\ \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}},\ \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_gaaf1d3e26e36b316977336066b6f56632}{evas\_object\_size\_hint\_align\_set}}(radio,\ \mbox{\hyperlink{Evas__Common_8h_aecbac710f36d52911fc34dcdaf8e729c}{EVAS\_HINT\_FILL}},\ \mbox{\hyperlink{Evas__Common_8h_aecbac710f36d52911fc34dcdaf8e729c}{EVAS\_HINT\_FILL}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(radio);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Smart__Object__Group_gac12dd6655f488cc47ce6cf00eb7d12b2}{evas\_object\_smart\_callback\_add}}(radio,\ \textcolor{stringliteral}{"{}changed"{}},\ \_cb,\ NULL);}

\end{DoxyCodeInclude}
 For our third callback we\textquotesingle{}ll omit the icon and set the value to 3, we\textquotesingle{}ll also add it to the group of the first radio\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ radio\ =\ \mbox{\hyperlink{group__Elm__Radio__Group_ga55ac57f03ef5a581b1fee0dce02961d2}{elm\_radio\_add}}(win);}
\DoxyCodeLine{\ \ \ elm\_object\_text\_set(radio,\ \textcolor{stringliteral}{"{}Radio\ 3"{}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Radio__Group_gac67d20c6bccac5b1ed81cddd76880235}{elm\_radio\_state\_value\_set}}(radio,\ 3);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Radio__Group_gae96fc2cfbb4c864641eb997a96dfa6e4}{elm\_radio\_value\_pointer\_set}}(radio,\ \&val);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Radio__Group_gaa597f8aaad338c0221dada51ac7e110f}{elm\_radio\_group\_add}}(radio,\ group);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Box__Group_ga66a10dd861578521af2ab7b8c2ca65c5}{elm\_box\_pack\_end}}(bx,\ radio);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9379629ad8ad2860aa786d838a4a106a}{evas\_object\_size\_hint\_weight\_set}}(radio,\ \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}},\ \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_gaaf1d3e26e36b316977336066b6f56632}{evas\_object\_size\_hint\_align\_set}}(radio,\ \mbox{\hyperlink{Evas__Common_8h_aecbac710f36d52911fc34dcdaf8e729c}{EVAS\_HINT\_FILL}},\ \mbox{\hyperlink{Evas__Common_8h_aecbac710f36d52911fc34dcdaf8e729c}{EVAS\_HINT\_FILL}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(radio);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Smart__Object__Group_gac12dd6655f488cc47ce6cf00eb7d12b2}{evas\_object\_smart\_callback\_add}}(radio,\ \textcolor{stringliteral}{"{}changed"{}},\ \_cb,\ NULL);}

\end{DoxyCodeInclude}
 Our fourth callback has a value of 4, no icon and most relevantly is not a member of the same group as the other radios\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ radio\ =\ \mbox{\hyperlink{group__Elm__Radio__Group_ga55ac57f03ef5a581b1fee0dce02961d2}{elm\_radio\_add}}(win);}
\DoxyCodeLine{\ \ \ elm\_object\_text\_set(radio,\ \textcolor{stringliteral}{"{}Radio\ 4"{}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Radio__Group_gac67d20c6bccac5b1ed81cddd76880235}{elm\_radio\_state\_value\_set}}(radio,\ 4);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Radio__Group_gae96fc2cfbb4c864641eb997a96dfa6e4}{elm\_radio\_value\_pointer\_set}}(radio,\ \&val);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Radio__Group_gaa597f8aaad338c0221dada51ac7e110f}{elm\_radio\_group\_add}}(radio,\ group);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Box__Group_ga66a10dd861578521af2ab7b8c2ca65c5}{elm\_box\_pack\_end}}(bx,\ radio);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9379629ad8ad2860aa786d838a4a106a}{evas\_object\_size\_hint\_weight\_set}}(radio,\ \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}},\ \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_gaaf1d3e26e36b316977336066b6f56632}{evas\_object\_size\_hint\_align\_set}}(radio,\ \mbox{\hyperlink{Evas__Common_8h_aecbac710f36d52911fc34dcdaf8e729c}{EVAS\_HINT\_FILL}},\ \mbox{\hyperlink{Evas__Common_8h_aecbac710f36d52911fc34dcdaf8e729c}{EVAS\_HINT\_FILL}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(radio);}

\end{DoxyCodeInclude}
 We finally run the main loop\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Smart__Object__Group_gac12dd6655f488cc47ce6cf00eb7d12b2}{evas\_object\_smart\_callback\_add}}(radio,\ \textcolor{stringliteral}{"{}changed"{}},\ \_cb,\ NULL);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(win);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__General_gadf2553f83e6b0b9c7fbe054019a664a1}{elm\_run}}();}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{return}\ 0;}
\DoxyCodeLine{\}}
\DoxyCodeLine{\mbox{\hyperlink{group__Elm__General_ga50fe52d513f7e89c9c770afd76de7ad9}{ELM\_MAIN}}()}

\end{DoxyCodeInclude}
 And the last detail in our example is the callback that prints {\ttfamily val} so that we can see that the radios are indeed changing its value\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_cb(\textcolor{keywordtype}{void}\ *data\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},\ \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}\ *obj\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},\ \textcolor{keywordtype}{void}\ *event\_info\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ printf(\textcolor{stringliteral}{"{}val\ is\ now:\ \%d\(\backslash\)n"{}},\ val);}
\DoxyCodeLine{\}}

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

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