Languages

Menu
Sites
Language
Genlist height

Hello guys,

Here is my code

mLayout = elm_genlist_add(parent);
evas_object_show(mLayout);


Elm_Genlist_Item_Class *itc2 = elm_genlist_item_class_new();
itc2->item_style = "full";
itc2->func.text_get = NULL;
itc2->func.content_get = gl_content_get;
itc2->func.state_get = NULL;
itc2->func.del = NULL;

then i am setting data and etc

gl_content_get generates an evas_object box wih buttons, labels and etc.

so when i run my program my genlist items dont expand to display data form "gl_content_get" correctly.

how can i increase genlist item height, so that my returned evas_object from gl_content_get displayed correctly?

 

Responses

3 Replies
Garik Bezruchko

Problem solved

I had to set min size of my evas_object like this for example: evas_object_size_hint_min_set(box_data, 400, 200);

Garik Bezruchko

Hello again,
Anyone know is it possible to create genlist with different item heights? so for ex i have genlist and want to insert labels with different amount of text. and if i set min size, as i previosly said i ll have to much white space or if i got long text i wont have enough space

Alex Dem

Hi,
I suppose you should use evas_object_size_hint_min_set/evas_object_size_hint_max_set
in your  'gl_content_get'.   'gl_content_get' is called when every item is created.

see UI Controls example->Genlist also, in this example all items are created in 'genlist_test_cb' method in cycle. The item data for every item is declared this way: 

item_data_s *id = calloc(sizeof(item_data_s), 1);
id->index = index;

The item data 'id' is third parameter in call:
 

elm_genlist_item_append(genlist,itc,id,NULL,ELM_GENLIST_ITEM_NONE,NULL,id); 

This parameter comes into 'gl_content_get_cb' (or it should comes into 'gl_content_get' in your case), hence you could add into 'gl_content_get' something like this:

    item_data_s *id = data;
    switch(id->index)
    {
      case 0:
           evas_object_size_hint_min_set(content, 50, 150);
           evas_object_size_hint_max_set(content, 50, 150);
           break;
      case 1:
           evas_object_size_hint_min_set(content, 50, 250);
           evas_object_size_hint_max_set(content, 50, 250);
           break;
//...
      default:
           evas_object_size_hint_min_set(content, 50, 50);
           evas_object_size_hint_max_set(content, 50, 50);
           break;
    }


This way you are able to set different height for items with different indexes.
Alexey.