언어 설정

Menu
Sites
Language
How to destroy a genlist? (Or at least all items)

Hi to all!

As the tittle says, How to destry a genlist? Well, there is the "_item_del" callback, but, I couldnt find in the documentation how to call the genlist destructor (who is going a use that callbacks) or at least destructor iterator for the items.

Anyone was dealing with that?

Thanks a lot!

답변 바로가기

Responses

3 댓글
Shaswati Saha

To delete an item of a genlist after selecting it, you may follow the way below:

ad->genlist = elm_genlist_add(ad->conform);

 ... ...

for (i = 0; i < 10; i++) {
    		elm_genlist_item_append(ad->genlist, /* Genlist object */
					itc, /* Genlist item class */
					(void *)i, /* Item data */
					NULL, /* Parent item */
					ELM_GENLIST_ITEM_NONE, /* Item type */
					del_genlist_item,/*Select callback.It is invoked if a genlist item is selected */
					ad); /* Callback data */
		}
 ... ...

The del_genlist_item callback can be written as below:

static void del_genlist_item(void *data, Evas_Object *obj)
{
    appdata_s *ad = data;;
	Elm_Object_Item *item = elm_genlist_selected_item_get(ad->genlist);
	elm_object_item_del(item);
}

 

Carlos Dominguez

Thanks a lot Saha, but stills my dilema, delete a selected item is easy because you have the object reference, but... For example, I have a genlist witch items represents files in a directory, and I want to refresh the genlist, then, I want to delete all items and read again the directory and generate the new list, How to make empty the genlist? (without selecting any item).

Thanks!!!!

Mark as answer
Shaswati Saha

In that case, modify the callback as below:

static void del_genlist_item(void *data, Evas_Object *obj)
{
    appdata_s *ad = data;;
    elm_genlist_clear(ad->genlist);
}