语言

Menu
Sites
Language
Dynamically add items to a genlist with different callbacks

Hi,

I am developing an application in which we can read lines from a file and then show the lines in a form a multiline genlist. In the sample codes the text for the genlist items is fixed.

 I would like to add the text dynamically to the genlist itmes and with different click callbacks.

Anyone has any information related to this?

查看选择的答案

响应

3 回复
Mark as answer
Iqbal Hossain

Hi,

You can add items dynamically in genlist with following methods,

    elm_genlist_item_append() // Inserts an item at the end
    elm_genlist_item_prepend() // Inserts an item at the beginning 
    elm_genlist_item_insert_before() // Inserts an item before another 

For more you can check,

https://developer.tizen.org/dev-guide/2.3.1/org.tizen.native.mobile.apireference/group__Genlist.html

You can also find a sample app from Tizen IDE. To get that,

New Tizen Native App>Online Sample>Contacts

Online Ref: https://developer.tizen.org/dev-guide/native/2.3.0/org.tizen.mobile.native.appprogramming/html/sample_descriptions/contacts_sd.htm

If you find my post helpful for you, please mark it as the Best Answer to promote this post to others.
Thanks.

 

Hermet Park

I can't figure out what the item exactly look like.

you can find genlist styles from the next links. Please compare and pick one among them.

https://developer.tizen.org/development/ui-practices/native-application/efl/ui-components/mobile-ui-components/genlist

Chanwook Jung

You can set the text using below API.

 

Eina_Bool edje_object_part_text_set  ( Edje_Object *  obj, const char *  part,  const char *  text)

obj = elm_object_item_edje_get (genlist item)

 

https://developer.tizen.org/dev-guide/2.4/org.tizen.native.mobile.apireference/group__Edje__Part__Text.html