Languages

Menu
Sites
Language
Can I use Genlist object int the conform/win or inside table?

Hi to all,

Well, the tittle is almos the question... The point is, I dont want a use naviframe, is possible or Genlist is mandatory attach to a Naviframe?

View Selected Answer

Responses

2 Replies
Mark as answer
Shaswati Saha

No, it's not mandatory to use naviframe. Please have a look into the following code snippet. It sets genlist into the conformant. I've added a comment also, have a look.

    Evas_Object *genlist;
    Elm_Genlist_Item_Class *itc;


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

	elm_object_content_set(ad->conform, genlist); //may be you're missing this line of code

	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);
}

 

Carlos Dominguez

Thanks a lot Saha!