Tabview can't slide right

What MCU/Processor/Board and compiler are you using?

lv_sim_visual_studio

What do you experience?

What do you expect?

First create a tileview, there are two tiles. Click on the second tile to create a tabview, the tabview has two tabs, the program will automatically jump to the second tab, right slide on the second tab will delete the tabview. When repeatedly right slide several times, the right slide will fail.

Code to reproduce

Add a code snippet to reproduce the issue in the simulator. It should contain only the relevant code which can be compiled. Bug reports without code snippets or with erroneous code snippets will not be reviewed.

/*You code here*/
static lv_obj_t *tabview = NULL;
static lv_obj_t *parentObj = NULL;
static lv_obj_t *tileview = NULL;
static void TabviewEventHandler(lv_obj_t *tabview, lv_event_t event)
{
    if (event == LV_EVENT_VALUE_CHANGED) {
        uint16_t curIndex = lv_tabview_get_tab_act(tabview);
        if (curIndex == 0) {
            lv_obj_del(tabview);
        }
    }
}

static void ObjEventHandle(lv_obj_t *obj, lv_event_t event)
{
    if (event == LV_EVENT_SHORT_CLICKED) {
        tabview = lv_tabview_create(obj, NULL);
        lv_obj_set_size(tabview, LV_HOR_RES_MAX, LV_VER_RES_MAX);
        lv_tabview_set_btns_pos(tabview, LV_TABVIEW_TAB_POS_NONE);
        lv_obj_t *tab1 = lv_tabview_add_tab(tabview, "Tab1");
        lv_obj_t *tab2 = lv_tabview_add_tab(tabview, "Tab2");
        lv_page_set_scrlbar_mode(tab2, LV_SCRLBAR_MODE_OFF);
        lv_page_set_scrlbar_mode(tab1, LV_SCRLBAR_MODE_OFF);
        lv_obj_set_event_cb(tabview, TabviewEventHandler);
        lv_obj_t *label = lv_label_create(tab2, NULL);
        lv_label_set_text(label, "Scroll right to exit the tabview");
        lv_obj_align(label, NULL, LV_ALIGN_CENTER, 0, 0);
        lv_tabview_set_tab_act(tabview, 1, LV_ANIM_OFF);
    }
}

void tabviewTest()
{
    static lv_point_t validPos[2] = { { 0, 0 }, {0, 1} };
    tileview = lv_tileview_create(lv_scr_act(), NULL);
    lv_tileview_set_valid_positions(tileview, validPos, 2);
    lv_obj_set_size(tileview, LV_HOR_RES_MAX, LV_VER_RES_MAX);
    lv_page_set_scrlbar_mode(tileview, LV_SCRLBAR_MODE_OFF);

    lv_obj_t * tile1 = lv_obj_create(tileview, NULL);
    lv_obj_set_pos(tile1, 0, 0);
    lv_obj_set_size(tile1, LV_HOR_RES_MAX, LV_VER_RES_MAX);
    lv_obj_t *label = lv_label_create(tile1, NULL);
    lv_label_set_text(label, "tile1,Scroll up to tile2");
    lv_obj_align(label, NULL, LV_ALIGN_CENTER, 0, 0);
    lv_tileview_add_element(tileview, tile1);

    lv_obj_t * tile2 = lv_obj_create(tileview, NULL);
    lv_obj_set_pos(tile2, 0, LV_VER_RES_MAX);
    lv_obj_set_size(tile2, LV_HOR_RES_MAX, LV_VER_RES_MAX);
    label = lv_label_create(tile2, NULL);
    lv_label_set_text(label, "tile2,Click to create a tabview");
    lv_obj_align(label, NULL, LV_ALIGN_CENTER, 0, 0);
    lv_obj_set_click(tile2, true);
    lv_obj_set_event_cb(tile2, ObjEventHandle);
    lv_tileview_add_element(tileview, tile2);
}
 

int main(int argc, char** argv)
{
    /*Initialize LittlevGL*/
    lv_init();

    /*Initialize the HAL for LittlevGL*/
    hal_init();

    tabviewTest();
    while (1) {
        /* Periodically call the lv_task handler.
        * It could be done in a timer interrupt or an OS task too.*/
        lv_task_handler();
        Sleep(10);       /*Just to let the system breathe */
    }

    return 0;
}

Screenshot and/or video

The last version of the mast branch had the same problem running this code with “lv_sim_codeblocks_win”.

This line says the (0;0) and (0;1) tiles are valid:

static lv_point_t validPos[2] = { { 0, 0 }, {0, 1} };

So a tile and another below it. There you can’t scroll right.

Thanks for your response.
Tabview can’t scroll right,not tileview. Create a tabview on the second tile,the tabview has two tabs,right slide on the second tab will delete the tabview. When repeatedly right slide several times, the right slide will fail.

Ah sorry, I got it now. Unfortunately I can’t reproduce the issue :frowning:
Some ideas:

  • Is it the same without tileview? (Just create the tabview on the screen.)
  • If you delete lv_tabview_set_btns_pos(tabview, LV_TABVIEW_TAB_POS_NONE); can you still change by clicking on the tab buttons?

.I try to create the tabview on a normal obj, it’s ok.
.The tab buttons is valid.

As I can’t reproduce it I can only try to remotely find the issue by asking questions. For first, is lv_page_scrollable_signal() in lv_page.c called when scrolling si dead? If so with which signals?

yes,it’s called.
when crolling is dead,i printf the signals like this:
sign:11
sign:8
sign:4
sign:6
sign:12
sign:12
sign:2
sign:2
sign:17
sign:12
sign:12
sign:2
sign:2
sign:12
sign:2
sign:2
sign:12
sign:2
sign:2
sign:12
sign:12
sign:14
sign:8
sign:4
sign:6
sign:18
sign:2
sign:2
sign:19

when crolling is ok ,the signals like this:
sign:4
sign:6
sign:4
sign:6
sign:22
sign:8
sign:4
sign:6
sign:1
sign:4
sign:6
sign:12
sign:12
sign:2
sign:2
sign:17
sign:12
sign:12
sign:2
sign:12
sign:2
sign:12
sign:12
sign:2
sign:14
sign:8
sign:4
sign:6
sign:18
sign:19
sign:0
sign:0
sign:0

The tab change happens in sign:18 (LV_SIGNAL_DRAG_THROW_BEGIN) and it is triggered in both cases. Can you debug what happens there?