Tizen Native API
Table example

In this example, we illustrate how to organize your objects on a table, using the edje_object_part_table functions. To be easier to understand the objects in this example will be four simple rects, when the user click over one item with the left button its is removed from the table, if any other button was used all items are removed. For each action is printed a message with the current number of rows and columns.

We started creating an EDC file with one part of the type TABLE called "table_part", that is the part which we will refer to access the table:

On the other hand, in the C file we first create the rectangles and added a callback for mouse down, as you can see bellow:

With the objects created we have to pack them into the table, to do this, we just have to use the function edje_object_part_table_pack().

The other bit of code that is relevant to us now is our event handler for when the user click over the rectangle. Here we use the function edje_object_part_table_unpack() to remove the item from the table or edje_object_part_table_clear() to remove all items, it depends on which mouse button the user uses.

Finally, the last important thing in this example is about how to know how many columns and rows are there in the table, It should be noted that this function don't tell you how many items are there in the table, just the number of the columns and rows of the table.

The example's window should look like this picture:

edje-table-example.png

The full source code follows:

To compile use this command:

 * gcc -o edje-table edje-table.c -DPACKAGE_BIN_DIR=\"/Where/enlightenment/is/installed/bin\" -DPACKAGE_LIB_DIR=\"/Where/enlightenment/is/installed/lib\"
 * -DPACKAGE_DATA_DIR=\"/Where/enlightenment/is/installed/share\"
 * `pkg-config --cflags --libs evas ecore ecore-evas edje`
 *
 * edje_cc table.edc
 *