语言

Menu
Sites
Language
Creating table in Tizen native app

Hi,

Please help me to correct this code for table container.  Im new to Tizen.

/*  Creating Table  */

    Evas_Object *table= evas_object_table_add(box);
    evas_object_table_homogeneous_set(table, EVAS_OBJECT_TABLE_HOMOGENEOUS_NONE);
    evas_object_table_padding_set(table, 0, 0);
    evas_object_resize(table, 10, 10);
    evas_object_show(table);

    Evas_Object *label = elm_label_add(table);
    elm_object_text_set(label, "Label1");
    evas_object_color_set(label, 255, 0, 0, 255);
    evas_object_size_hint_min_set(label, 100, 50);
    evas_object_show(label);
    evas_object_table_pack(table, label, 1, 1, 2, 1);

    Evas_Object *label1 = elm_label_add(table);
    elm_object_text_set(label1, "Label2");
    evas_object_color_set(label1, 0, 255, 0, 255);
    evas_object_size_hint_min_set(label1, 50, 100);
    evas_object_show(label1);
    evas_object_table_pack(table, label1, 1, 2, 1, 2);

响应

4 回复
colin Rao

Hi, you should to use the elm_* function.

F.Y.I.

    ad->box = elm_box_add(ad->conform);
    evas_object_size_hint_weight_set(ad->box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
	evas_object_size_hint_align_set(ad->box, EVAS_HINT_FILL, EVAS_HINT_FILL);
	elm_box_align_set(ad->box, 0.0, 0.2);
	evas_object_show(ad->box);
	elm_box_padding_set(ad->box, ELM_SCALE_SIZE(5), ELM_SCALE_SIZE(15));

	Evas_Object *table = elm_table_add(ad->box);
	elm_table_homogeneous_set(table, EINA_TRUE);
	evas_object_size_hint_weight_set(table, EVAS_HINT_EXPAND, 0);
	evas_object_size_hint_align_set(table, 0, 0);
	elm_table_padding_set(table, ELM_SCALE_SIZE(5), ELM_SCALE_SIZE(5));
	evas_object_show(table);
	elm_box_pack_end(ad->box, table);

	Evas_Object *label = elm_label_add(table);
	elm_object_text_set(label, "Label1");
	evas_object_color_set(label, 255, 0, 0, 255);
	evas_object_size_hint_min_set(label, 100, 50);
	evas_object_show(label);
	elm_table_pack(table, label, 0, 0, 1, 1);

	Evas_Object *label1 = elm_label_add(table);
	elm_object_text_set(label1, "Label2");
	evas_object_color_set(label1, 0, 255, 0, 255);
	evas_object_size_hint_min_set(label1, 100, 50);
	evas_object_show(label1);
	elm_table_pack(table, label1, 0, 1, 1, 1);

 

Alex Ashirov

Hi,

Is you box object of type Evas? Otherwise, you need to use

evas_object_table_add_to  (box)

instead of

evas_object_table_add(box);

In general, it seems that you need to use Elementary (what is widget set) instead of Evas. For more information how to use table container in Elementary please refer to:

https://developer.tizen.org/documentation/mobile-native-app-programming/programming-guide/ui-creating-application-ui/widgets/container-widgets/table-container

Alex Dem

Hi,
Or (if box is  Evas_Object) you could use evas_object_table_add(evas_object_evas_get(box));
Alexey.

Alex Ashirov

Hi,

evas_object_table_add_to  (box) does such conversion from Evas_Object* to Evas* internally. So, it’s just shorter implementation of the same.