Hello,
I am currently experimenting with lv_menu. I have been able to start menu disposition with a first page “Home”, using mostly lv_menu and flex layout. So far so good.
Problem is that for now I have been unable to resize (or at least tune its dynamic behaviour) the sidebar, which takes a good chunk of the screen.
Test setup
LVGL port on Windows for Visual studio (8.3.?)
Visual result so far
Source code
void GUI::Create(lv_obj_t* parent)
{
lv_obj_t* cont;
lv_obj_t* section;
/* Création du système de menu */
lv_obj_t* menu = lv_menu_create(parent);
lv_obj_set_size(menu, lv_pct(100), lv_pct(100));
/* Page Menu principal */
lv_obj_t* main_menu_page = lv_menu_page_create(menu, NULL);
lv_obj_set_style_pad_hor(main_menu_page, lv_obj_get_style_pad_left(lv_menu_get_main_header(menu), 0), 0);
section = lv_menu_section_create(main_menu_page);
lv_obj_set_style_max_width(main_menu_page, 100, LV_STATE_DEFAULT);
lv_menu_set_sidebar_page(menu, main_menu_page);
lv_obj_set_style_max_width(lv_menu_get_cur_sidebar_page(menu), 100, LV_STATE_DEFAULT);
/* Page Overview */
lv_obj_t* page_overview = lv_menu_page_create(menu, NULL);
cont = create_text(section, LV_SYMBOL_HOME, "Home");
Overview::Create(page_overview);
lv_menu_set_load_page_event(menu, cont, page_overview);
lv_event_send(lv_obj_get_child(lv_obj_get_child(lv_menu_get_cur_sidebar_page(menu), 0), 0), LV_EVENT_CLICKED, NULL);
}
I’ll skip on Overview::Create (it contains the logic for the page_overview creation) and create_text (which is pretty much LVGL example menu 5).
I tried some stuff like setting max width of the section, of the sidebar reference itself, as well as calling …_set_flex_grow(…), but no luck so far.
Any tips to avoid the sidebar taking a massive chunk of the available space ?
Thanks in advance.