- Elementary
- Main
- Authors
- Examples
- Files
- Pages
- Types
- Modules

List widget example

This code places a single Elementary list widgets on a window, just to exemplify the more simple and common use case: a list will be created and populated with a few items.

To keep it simple, we won't show how to customize the list, for this check List widget example. Also, we won't focus on items management on this example. For an example about this subject, check List - Items management.

To add a list widget.

li = elm_list_add(win);

We are just adding the list, so as you can see, defaults for it are:

- Items are displayed vertically.
- Only one item can be selected.
- The list doesn't bounce.

To add items, we are just appending it on a loop, using function elm_list_item_append(), that will be better explained on items management example.

static const char *lbl[] =
{
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"
};
for (i = 0; i < sizeof(lbl) / sizeof(lbl[0]); i++)
elm_list_item_append(li, lbl[i], NULL, NULL, NULL, NULL);

After we just want to show the list. But first we need to start the widget. It was done this way to improve widget's performance. So, always remember that:

Warning
  Call elm_list_go before showing the object
  elm_list_go(li);
  evas_object_show(win);

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

Copyright ©2000-2014 Enlightenment.org - Samsung Electronics supports the EFL Documentation Project - Generated Wed Jan 8 2014 20:51:07