언어 설정

Menu
Sites
Language
Is it possible to add a Genlist Widget under a to a toolbar

Hello, guys. I'm having a trouble with adding some genlists to toolbar. As I understood due to Samples, a genlist can be added with a callback function, when you click on an item in a toolbar. but when I do this, I do not see it (and my eyes are not so bad :)
I'm trying to do the following:
 

​elm_toolbar_item_append(toolbar, NULL, "ItemLabel", callbackFunc, this);

and the body of the callbackFunc is here:
 

void callbackFunc(void *data, Evas_Object *obj, void *event_info)
{
    char edj_path[PATH_MAX] = {0, };
    Evas_Object *layout = elm_layout_add(obj);
    elm_layout_file_set(layout, edj_path, "groupnamehere");
    Evas_Object *list = elm_genlist_add(layout);
    Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new();
    itc->item_style = "default_style";
    for (int i = 0; i < 10; i++) {
        elm_genlist_item_append(list, itc, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
    }
    elm_object_part_content_set(layout, "list", list);
    evas_object_show(list);
    evas_object_show(layout);
}

here you can see the part name list, which I've got in the edc with type SWALLOW in order to put my layout+genlist there:

       part
       { name: "list"; type: SWALLOW;
         description { state: "default" 0.0;
                       rel1 { relative: 0.0 0.0; to: "toolbar"; }
                       rel2 { relative: 1.0 1.0; }
                       color: 255 0 0 255;
                     }
       }

Seems legit. But there's nothing at all, not even an empty genlist.

Responses

1 댓글
Alex Dem

Hi,
You should get parent (Evas_Object*) to place 'layout'  from first incoming parameter .

I was able to add simple empty default genlist (naviframe->layout->genlist) this way:

elm_toolbar_item_append(toolbar, ICON_DIR"/00_controlbar_icon_genlist.png", "GenList", add_genlist, parent); //parent is naviframe
static void add_genlist(void *data, Evas_Object *obj, void *event_info)
{
    Evas_Object *nf = data;
    Evas_Object *layout = elm_layout_add(nf);
    elm_layout_file_set(layout, ELM_DEMO_EDJ, "my_layout");

    Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new();
    itc->item_style = "default_style";

    Evas_Object *list = elm_genlist_add(layout);
    for (int i = 0; i < 10; i++) {
        elm_genlist_item_append(list, itc, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
    }
    elm_object_part_content_set(layout, "my_list", list);
    elm_object_content_set(nf, layout);
}

my simplest edc part:

      part  { name: "mylist"; 
               type: SWALLOW;
               description {  }
       }

Alexey.