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:

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

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

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

  • We make it bounce horizontally but not vertically.
  • We make both scrollbars always be visible.
  • We have the events be propagated from the content to the scroller.
  • We enforce a page policy vertically(having a page be the size of the viewport) and leave horizontal scrolling free.
  • And finally we ask the scroller to show us a region starting at 50,50 and having a width and height of 200px.
    Note
    Observant reader will note that the elm_scroller_region_show() didn't scroll the view vertically, this is because we told the scroller to only accept vertical scrolling in pages.
    And now we're done:
    Our example will look like this: