I’m using the littlevgl library on a PIC32MK1024GPD micro-controller with a 320x240 TFT display. The application I’m designing contains multiple screens where the user needs to navigate. I saw from the documentation that I can create multiple screens using littlevgl and than hide/show the ones I need during run time. The issue with this is that I would be consuming RAM also for the hidden screens. Thus, I’m using only one screen and delete all the children and re-create them according to the screen to display.
As for menu structure, I made a very basic thing myself but I was asking if there is a ‘proper’ way to do this when using the littlevgl library. So my question is, is there a proper way when using littlevgl to perform menu/screens navigation without having a screen object for every screen?
This is a example for you.
/Create a window/
lv_obj_t * win = lv_win_create(lv_scr_act(), NULL);
lv_win_set_title(win, “Window title”); /Set the title/
/*Add control button to the header*/
lv_obj_t * close_btn = lv_win_add_btn(win, LV_SYMBOL_CLOSE); /*Add close button and use built-in close action*/
lv_win_add_btn(win, LV_SYMBOL_SETTINGS); /*Add a setup button*/
/*Add some dummy content*/
lv_obj_t * txt = lv_label_create(win, NULL);
lv_label_set_text(txt, "This is the content of the window\n\n"
"You can add control buttons to\n"
"the window header\n\n"
"The content area becomes automatically\n"
"scrollable is it's large enough.\n\n"
" You can scroll the content\n"
"See the scroll bar on the right!");
Thanks for the example. If I’m understanding correctly, i make every page of my menu as a screen which is drawn/deleted as required. So every time I need to change the page, I would delete the current screen using lv_obj_del(scr) and re-draw the screen and load it using lv_scr_load(scr).
What I’m trying to work around now is the menu navigation. So to have buttons to change different screens. After some search, I came across the lv_ex_settings example which could give me an idea of how to structure the menu navigation. From what I can tell, is still a work in progress but I haven’t tried it yet.
Do you have an idea of how can I structure a menu tree, for example, having the home page with 4 buttons, thus 4 possible pages, with each page having its own nested pages etc…