언어 설정

Menu
Sites
Language
Genlist dont show element

Ho to all!

I have this code:

 

ad->open_win = elm_win_util_standard_add(PACKAGE, PACKAGE);
    elm_win_autodel_set(ad->open_win, EINA_TRUE);
    Evas_Object *open_conform;
    Evas_Object *open_table;
    open_conform = elm_conformant_add(ad->open_win);
    elm_win_indicator_mode_set(ad->open_win, ELM_WIN_INDICATOR_SHOW);
    elm_win_indicator_opacity_set(ad->open_win, ELM_WIN_INDICATOR_OPAQUE);
    evas_object_size_hint_weight_set(open_conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    elm_win_resize_object_add(ad->open_win, open_conform);
    evas_object_show(open_conform);

    open_table = elm_table_add(ad->open_win);

    elm_object_content_set(open_conform, open_table);
    evas_object_show(open_table);

    /*List view*/
    ad->file_list = elm_genlist_add(open_table);
    ad->file_itc = elm_genlist_item_class_new();
    ad->file_itc->item_style = "default";
    ad->file_itc->func.text_get = _item_label_get;
    ad->file_itc->func.content_get = NULL;
    ad->file_itc->func.state_get = NULL;
    ad->file_itc->func.del = NULL;

    int i = 1;

    elm_list_mode_set(ad->file_list, ELM_LIST_COMPRESS);

    elm_genlist_item_append(ad->file_list, ad->file_itc, (void *)i, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
    evas_object_size_hint_weight_set(ad->file_list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_size_hint_align_set(ad->file_list, EVAS_HINT_FILL, 0.5);
    elm_table_pack(open_table, ad->file_list,0,0,4,4);
    elm_list_go(ad->file_list);
    evas_object_show(ad->file_list);
    /*List view End*/

 

But dont show the element i the list...

I can not detect the fault, any suggestion?

Thanks to all!

답변 바로가기

Responses

4 댓글
Shaswati Saha

Hi  Carlos,
You may use the code below. It's working like a charm!

ad->nf = elm_naviframe_add(ad->conform);
evas_object_show(ad->nf);
elm_object_content_set(ad->conform, ad->nf);

Evas_Object *genlist;
Elm_Genlist_Item_Class *itc;

genlist = elm_genlist_add(ad->nf);
evas_object_show(genlist);
elm_naviframe_item_push(ad->nf, "Genlist", NULL, NULL, genlist, NULL);

itc = elm_genlist_item_class_new();
itc->item_style = "default";
itc->func.text_get = _item_label_get;
itc->func.del = _item_del;

int i;
for (i = 0; i < 10; i++) {
    elm_genlist_item_append(genlist, /* Genlist object */
                            itc, /* Genlist item class */
                            (void *)i, /* Item data */
                            NULL, /* Parent item */
                            ELM_GENLIST_ITEM_NONE, /* Item type */
                            NULL, /* Select callback */
                            NULL); /* Callback data */
}
elm_genlist_item_class_free(itc);

And the callbacks can be written like below:

static char *_item_label_get(void *data, Evas_Object *obj, const char *part)
{
    char buf[16];
	int i = (int) data;
	if (!strcmp(part, "elm.text")) {
		sprintf(buf, "text %d", i);

		return strdup(buf);
	}

	else return NULL;
}
static void _item_del(void *data, Evas_Object *obj)
{
   printf("item(%d) is now deleted", (int) data);
}

Note: It's not a must to use naviframe. You may also add the genlist to the conformant.
 

Carlos Dominguez

Thanks Saha, But still the same, I am uning the conform... no way, any other suggestion?

Carlos Dominguez

Actually works with naviframe, but not with conform or win or even table... and I dont want to use naviframe for some reasons...

Mark as answer
Shaswati Saha

Hi Carlos
Check this link, hope it'll be helpful for you.