win_demo.lua 853 B

123456789101112131415161718192021222324252627
  1. local win_demo = {}
  2. function win_demo.demo()
  3. --Create a window
  4. local win = lvgl.win_create(lvgl.scr_act(), nil);
  5. lvgl.win_set_title(win, "Window title"); --Set the title
  6. --Add control button to the header
  7. local close_btn = lvgl.win_add_btn(win, LV_SYMBOL_CLOSE); --Add close button and use built-in close action
  8. lvgl.obj_set_event_cb(close_btn, lvgl.win_close_event_cb);
  9. lvgl.win_add_btn(win, LV_SYMBOL_SETTINGS); --Add a setup button
  10. --Add some dummy content
  11. local txt = lvgl.label_create(win, nil);
  12. lvgl.label_set_text(txt,
  13. [[This is the content of the window
  14. You can add control buttons to
  15. the window header
  16. The content area becomes
  17. automatically scrollable is it's
  18. large enough.
  19. You can scroll the content
  20. See the scroll bar on the right!]]);
  21. end
  22. return win_demo