Scroller example

This example is very short and will illustrate one way to use a scroller. We'll omit the declaration of the text variable because it's a very long ipsum lorem . If you really want to see the full code, it's scroller_example_01.c.

We start our example by creating our window and background:

EAPI_MAIN int
elm_main(int argc, char **argv)
{
   Evas_Object *win, *bg, *label, *scroller;

   win = elm_win_add(NULL, "scroller", ELM_WIN_BASIC);
   elm_win_title_set(win, "Scroller");
   elm_win_autodel_set(win, EINA_TRUE);
   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);

   bg = elm_bg_add(win);
   evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   elm_win_resize_object_add(win, bg);
   evas_object_show(bg);

Next we create a label and set it's text to text(very long ipsum lorem):

   label = elm_label_add(win);
   elm_object_text_set(label, text);
   evas_object_show(label);

We then create our scroller, ask that it have the same size as the window and set its content:

   scroller = elm_scroller_add(win);
   evas_object_size_hint_weight_set(scroller, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   elm_win_resize_object_add(win, scroller);
   evas_object_show(scroller);
   elm_object_content_set(scroller, label);

We are now going to set a number of properties in our scroller:

Our example will look like this:

scroller_example_01.png