List widget example

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);
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.

See the full list_example_02.c code, whose window should look like this picture:

list_example_02.png