

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 \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 \hyperlink{group__General_gabada1ccecc6a712df48e90cbf9915c35}{elm\+\_\+exit()}. 
\begin{DoxyCodeInclude}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
on\_click(\textcolor{keywordtype}{void} *data, Evas\_Object *obj, \textcolor{keywordtype}{void} *event\_info)
\{
   elm_exit();
\}

\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}

\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}

\end{DoxyCodeInclude}


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

\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}

\end{DoxyCodeInclude}


And we are done. 