page_demo.lua 1.0 KB

1234567891011121314151617181920212223
  1. local page_demo = {}
  2. function page_demo.demo()
  3. --Create a page
  4. local page = lvgl.page_create(lvgl.scr_act(), nil);
  5. lvgl.obj_set_size(page, 150, 200);
  6. lvgl.obj_align(page, nil, lvgl.ALIGN_CENTER, 0, 0);
  7. --Create a label on the page
  8. local label = lvgl.label_create(page, nil);
  9. lvgl.label_set_long_mode(label, lvgl.LABEL_LONG_BREAK); --Automatically break long lines
  10. lvgl.obj_set_width(label, lvgl.page_get_width_fit(page)); --Set the label width to max value to not show hor. scroll bars
  11. lvgl.label_set_text(label,
  12. [[Lorem ipsum dolor sit amet, consectetur adipiscing elit,sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
  13. Ut enim ad minim veniam, quis nostrud exercitation ullamco
  14. laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
  15. dolor in reprehenderit in voluptate velit esse cillum dolore
  16. eu fugiat nulla pariatur.
  17. Excepteur sint occaecat cupidatat non proident, sunt in culpa
  18. qui officia deserunt mollit anim id est laborum.]]);
  19. end
  20. return page_demo