Table
A table is like a box but with 2 dimensions. You have the same kind of APIs as with boxes. An item inside the table can span multiple columns and rows, and even overlap with other items (and it can then be raised or lowered accordingly to adjust stacking if there is overlap).
Creating a Table
To create a table, use the elm_table_add() function:
Evas_Object *table; table = elm_table_add(parent);
Adding Items to the Table
Items are added to the table with the elm_table_pack() function. This function takes as parameters the table, the item to add to the table, and the position where to add the item: column, row, and the size of the item in number of rows and columns (colspan and rowspan).
To create an icon that takes 3 columns and rows and a button that only takes 1 row and column:
ic = elm_icon_add(table); elm_image_file_set(ic, "icon.png", NULL); evas_object_show(ic); elm_table_pack(table, ic, 0, 0, 3, 3); btn = elm_button_add(table); elm_object_text_set(btn, "Click me i'm famous"); evas_object_show(btn); elm_table_pack(table, btn, 3, 1, 1, 1); evas_object_show(table);
Managing the Items
To manage the items:
-
To change the position of the item after adding it, use the elm_table_pack_set() function. This function takes as parameters the item whose position to change, the new column, the new row, and the size of the item in number of rows and columns (colspan and rowspan).
-
To add padding around the item, use the elm_table_padding_set() function. The second parameter is the padding between columns, and the third parameter is the padding between rows:
elm_table_padding_set(table, 10, 10);
-
To change the alignment and size of an item, use the evas_object_size_hint_XXX() functions. They are used in the same way as with boxes. You can set the same size and weight to each item by using the homogeneous parameter:
elm_table_homogeneous_set(table, EINA_TRUE);
-
To clear all table items, use the elm_table_clear() function. If the clear parameter is EINA_TRUE, the table items are deleted as the evas_object_del() function is called on each item.
Note |
---|
Except as noted, this content is licensed under LGPLv2.1+. |