@@ -70,38 +70,34 @@ script:
7070 auto* button_tab_info = lv_tabview_get_tab_button(id(tabview_main), idx_tab_info);
7171
7272 // A tabview is just a lv_obj with a list of buttons; please note that there is NO buttonmatrix used.
73- // So to hide a whole tab we need to hide both:
74- // 1) the tab content (which is a lv_obj)
75- // 2) the corresponding button in the tabview's button list (which is a lv_btn)
73+ // So to hide a whole tab we hide the corresponding button in the tabview's button list (which is a lv_btn)
7674 // see https://lvgl.io/docs/open/9.5/API/widgets/tabview/lv_tabview_h.html
75+ //
76+ // Please note that the tab content itself should not be hidden with something like:
77+ // lv_obj_add_flag(id(tab_rooms), LV_OBJ_FLAG_HIDDEN);
78+ // because that would interfere with the indexing of the tabs
7779 if (tab_rooms_enabled_str == "0") {
7880 ESP_LOGI("script", "Hiding the 'Rooms' tab since tab_rooms_enabled is set to %s", tab_rooms_enabled_str.c_str());
79- lv_obj_add_flag(id(tab_rooms), LV_OBJ_FLAG_HIDDEN);
8081 lv_obj_add_flag(button_tab_rooms, LV_OBJ_FLAG_HIDDEN);
8182 }
8283 if (tab_heating_set_temp_enabled_str == "0") {
8384 ESP_LOGI("script", "Hiding the 'Heating Set Temp' tab since tab_heating_set_temp_enabled is set to %s", tab_heating_set_temp_enabled_str.c_str());
84- lv_obj_add_flag(id(tab_heating_set_temp), LV_OBJ_FLAG_HIDDEN);
8585 lv_obj_add_flag(button_tab_heating_set_temp, LV_OBJ_FLAG_HIDDEN);
8686 }
8787 if (tab_heating_details_enabled_str == "0") {
8888 ESP_LOGI("script", "Hiding the 'Heating Details' tab since tab_heating_details_enabled is set to %s", tab_heating_details_enabled_str.c_str());
89- lv_obj_add_flag(id(tab_heating_details), LV_OBJ_FLAG_HIDDEN);
9089 lv_obj_add_flag(button_tab_heating_details, LV_OBJ_FLAG_HIDDEN);
9190 }
9291 if (tab_cover_enabled_str == "0") {
9392 ESP_LOGI("script", "Hiding the 'Cover' tab since tab_cover_enabled is set to %s", tab_cover_enabled_str.c_str());
94- lv_obj_add_flag(id(tab_covers), LV_OBJ_FLAG_HIDDEN);
9593 lv_obj_add_flag(button_tab_covers, LV_OBJ_FLAG_HIDDEN);
9694 }
9795 if (tab_scenes_enabled_str == "0") {
9896 ESP_LOGI("script", "Hiding the 'Scenes' tab since tab_scenes_enabled is set to %s", tab_scenes_enabled_str.c_str());
99- lv_obj_add_flag(id(tab_scenes), LV_OBJ_FLAG_HIDDEN);
10097 lv_obj_add_flag(button_tab_scenes, LV_OBJ_FLAG_HIDDEN);
10198 }
10299 if (tab_info_enabled_str == "0") {
103100 ESP_LOGI("script", "Hiding the 'Info' tab since tab_info_enabled is set to %s", tab_info_enabled_str.c_str());
104- lv_obj_add_flag(id(tab_info), LV_OBJ_FLAG_HIDDEN);
105101 lv_obj_add_flag(button_tab_info, LV_OBJ_FLAG_HIDDEN);
106102 }
107103
0 commit comments