Using LVGL V9.
I am trying to make it so that I can navigate a table only with buttons on the screen itself. This works well but when I disable the SCROLLABLE
flag on the table object, the scrollbar dissapears. I cannot remove the CLICKABLE
flag from the table because I want to be able to click on some of the cells.
Here is my code:
lv_obj_t* btnUp = lv_button_create(topBar);
lv_obj_add_style(btnUp, &Style_ExitBtn, LV_PART_MAIN);
lv_obj_set_style_text_color(btnUp, lv_color_hex(UI_COL_WHITE), LV_PART_MAIN);
lv_obj_set_size(btnUp, TOP_BAR_HEIGHT, TOP_BAR_HEIGHT);
lv_obj_align_to(btnUp, labTitle, LV_ALIGN_OUT_RIGHT_MID, 20, 0);
lv_obj_t* labBtnUp = lv_label_create(btnUp);
lv_label_set_text_static(labBtnUp, LV_SYMBOL_UP);
lv_obj_center(labBtnUp);
lv_obj_t* btnDown = lv_button_create(topBar);
lv_obj_add_style(btnDown, &Style_ExitBtn, LV_PART_MAIN);
lv_obj_set_style_text_color(btnDown, lv_color_hex(UI_COL_WHITE), LV_PART_MAIN);
lv_obj_set_size(btnDown, TOP_BAR_HEIGHT, TOP_BAR_HEIGHT);
lv_obj_align_to(btnDown, btnUp, LV_ALIGN_OUT_RIGHT_MID, 0, 0);
lv_obj_t* labBtnDown = lv_label_create(btnDown);
lv_label_set_text_static(labBtnDown, LV_SYMBOL_DOWN);
lv_obj_center(labBtnDown);
/* This assigns these buttons to my table object, clicking the buttons will trigger event callbacks
that call ``lv_scroll_by()``. Works with the OBJ_FLAG_SCROLLABLE flag removed. */
ui_assignBtnScroll(btnUp, btnDown, NULL, NULL,
Table, DISP_VER_RES - TOP_BAR_HEIGHT - HEADER_HEIGHT);
lv_obj_remove_flag(Table, LV_OBJ_FLAG_SCROLLABLE);
lv_obj_set_scrollbar_mode(Table, LV_SCROLLBAR_MODE_ON);
EDIT:
I see that removing the SCROLLABLE flag invalides the scrollbar area. Is it perhaps possible to “revalidate” the scrollbar area after the fact?