Tizen Native API
7.0
|
Keeping the tradition, this is a simple "Hello, World" button example. We will show how to create a button and associate and action to be performed when you click on it.
The full code of the example is 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 elm_exit().
static void on_click(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { elm_exit(); }
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).
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.
Then we create a background associated to the window, define its dimensions, and turn it visible on the canvas.
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.
And we are done.