Tizen Native API
7.0
|
This code places a single Elementary list widgets on a window, exemplifying a part of the widget's API.
First, we will just create a simple list, as done on List widget example :
static const char *lbl[] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" }; li = elm_list_add(win); evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(win, li); for (i = 0; i < sizeof(lbl) / sizeof(lbl[0]); i++) elm_list_item_append(li, lbl[i], NULL, NULL, NULL, NULL);
Now, let's customize this list a bit. First we will display items horizontally:
Then we will choose another list mode. There are four of them, and the default Elm_List_Mode is ELM_LIST_SCROLL. Let's set compress mode:
To enable multiple items selection, we need to enable it, since only one selected item is allowed by default:
We are not adding items with callback functions here, since we'll explain it better on List - Items management. But if the callback need to be called everytime user clicks an item, even if already selected, it's required to enable this behavior:
Finally, if a bounce effect is required, or you would like to see scrollbars, it is possible. But, for default theme, list scrollbars will be invisible anyway.
elm_scroller_bounce_set(li, EINA_TRUE, EINA_TRUE); elm_scroller_policy_set(li, ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_ON);
See the full source code for this example.