Description
As I read in the changelog, the tabview widget does not have a buttonmatrix in V9 anymore, but an array of buttons. So the styling of this component is different, but there’s no updated widget documentation for V9 right now. Styling the inactive buttons with
lv_obj_t* tab_buttons = lv_tabview_get_tab_bar(tabview);
lv_obj_add_style(tab_buttons, &style_btn_inactive, 0);
works as before, but styling the active tab sheet with something like
lv_obj_t* tab_buttons = lv_tabview_get_tab_bar(tabview);
lv_obj_add_style(tab_buttons, &style_btn_active, LV_PART_ITEMS | LV_STATE_CHECKED);
does not work anymore.
I debugged the lvgl a little bit in the VS simulator and I found that it’s possible to apply the style of the active buttons in the following way:
lv_obj_t* tab_buttons = lv_tabview_get_tab_bar(tabview);
lv_obj_t* button = NULL;
int i = 0;
do
{
button = lv_obj_get_child_by_type(tab_buttons, i, &lv_button_class);
if (button!=NULL)
lv_obj_add_style(button, &style_btn_active, LV_STATE_CHECKED);
i++;
} while (button != NULL);
This works, but it looks too complicated.
What MCU/Processor/Board and compiler are you using?
VS simulator and a Waveshare 4.3" TFT on ESP32-S3 with ESP-IDF
What LVGL version are you using?
V9.0.0
What do you want to achieve?
Recommend way how to style the tabview.