

Keeping the tradition, this is a simple \char`\"{}\+Hello, World\char`\"{} button example. We will show how to create a button and associate and action to be performed when you click on it.

In the end, we\textquotesingle{}ll be presented with something that looks like this\+:

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


The full code of the example is \mbox{\hyperlink{button_example_00_8c-example}{here}} and we will follow here with a rundown of it.

There is only one button on the interface which performs a basic action\+: close the application. This behavior is described by on\+\_\+click() function, that interrupt the program invoking \mbox{\hyperlink{group__Elm__General_gabada1ccecc6a712df48e90cbf9915c35}{elm\+\_\+exit()}}. 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{on\_click(\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}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ *event\_info\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__General_gabada1ccecc6a712df48e90cbf9915c35}{elm\_exit}}();}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}


On the main() function, we set the basic characteristics of the user interface. First we use the Elementary library to create a window and set its policies (such as close when the user click on the window close icon).


\begin{DoxyCodeInclude}{0}

\end{DoxyCodeInclude}
 In order to turn it visible on the WM (Window Manager), we also have to associate it to a canvas through Evas library, and set its dimensions.


\begin{DoxyCodeInclude}{0}

\end{DoxyCodeInclude}
 Then we create a background associated to the window, define its dimensions, and turn it visible on the canvas. 
\begin{DoxyCodeInclude}{0}

\end{DoxyCodeInclude}


Finally we use Elementary to create a button and Evas to set its proprieties. Here we have not only to give the button dimensions, but also its coordinates and the action to be performed on the click event. 
\begin{DoxyCodeInclude}{0}

\end{DoxyCodeInclude}


And we are done. 