Bugs with tileview

Description

There are a few bugs i’m seeing with the tile view.

  1. After the creation of the tileview, the “tile” in position 0,0 must be created otherwise the other tiles created won’t function properly. So if i have a set of valid positions that looks like this: {{0,0},{1,0}} and i create the tile in {1,0} first, it wont’ be created properly unless {0,0} is created first. Swapping the ordering of the creation seems to work fine with the exact same code.
  2. Having an lv_obj wrapping an lv_list does not allow for page drag. It seems to lose the “page_glue” property somewhere in the chain despite having both elements being called with the lv_tileview_add_element property.

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

NXP

What do you experience?

  1. The tile at position 0,0 must be created first before any other tiles within the tile view. The work around here is to just create an empty tile at 0,0 and this seems to resolve the problem.
  2. Lists do not allow for the tile view to be dragged and navigated unless it is added directly to the tile view. It cannot be wrapped with an lv_obj. So there is something special about the interaction between a list and a tile view that doesn’t seem to propagate when wrapped with another obj.

What do you expect?

  1. Tiles should be created irrespective of order of creation.
  2. Lists should still allow for tileviews to be navigated even if it is within an lv_obj

Code to reproduce

1) creation order bug

In this example, its a copy of the lv_tileview example except the order of creation of tile1 and the list are swapped. In this case, the list is not created and that tile is empty.

    lv_init();
    lv_port_disp_init(NULL);
    static lv_indev_t input_device;

    lv_port_indev_init(&input_device);
    lv_indev_set_group(&input_device, lv_group_create());

    static lv_point_t valid_pos[] = {{0,0}, {0, 1}, {1,1}};
    lv_obj_t *tileview;
    tileview = lv_tileview_create(lv_scr_act(), NULL);
    lv_tileview_set_valid_positions(tileview, valid_pos, 3);
    lv_tileview_set_edge_flash(tileview, true);

    /*Tile2: a list*/
    lv_obj_t * list = lv_list_create(tileview, NULL);
    lv_obj_set_size(list, LV_HOR_RES, LV_VER_RES);
    lv_obj_set_pos(list, 0, LV_VER_RES);
    lv_list_set_scroll_propagation(list, true);
    lv_list_set_scrollbar_mode(list, LV_SCROLLBAR_MODE_OFF);

    lv_list_add_btn(list, NULL, "One");
    lv_list_add_btn(list, NULL, "Two");
    lv_list_add_btn(list, NULL, "Three");
    lv_list_add_btn(list, NULL, "Four");
    lv_list_add_btn(list, NULL, "Five");
    lv_list_add_btn(list, NULL, "Six");
    lv_list_add_btn(list, NULL, "Seven");
    lv_list_add_btn(list, NULL, "Eight");

    lv_obj_t * tile1 = lv_obj_create(tileview, NULL);
    lv_obj_set_size(tile1, LV_HOR_RES, LV_VER_RES);
    lv_tileview_add_element(tileview, tile1);

    /*Tile1: just a label*/
    lv_obj_t * label = lv_label_create(tile1, NULL);
    lv_label_set_text(label, "Scroll down");
    lv_obj_align(label, NULL, LV_ALIGN_CENTER, 0, 0);

    /*Tile3: a button*/
    lv_obj_t * tile3 = lv_obj_create(tileview, tile1);
    lv_obj_set_pos(tile3, LV_HOR_RES, LV_VER_RES);
    lv_tileview_add_element(tileview, tile3);

    lv_obj_t * btn = lv_btn_create(tile3, NULL);
    lv_obj_align(btn, NULL, LV_ALIGN_CENTER, 0, 0);
    lv_tileview_add_element(tileview, btn);
    label = lv_label_create(btn, NULL);
    lv_label_set_text(label, "No scroll up");

2) lv_obj bug

This example is a copy of the example listed in the tileview documentation, however tile2 is created as an lv_obj and an lv_list is created with a parent of the newly created tile rather than having the list created with a parent of the tileview.

    lv_init();
    lv_port_disp_init(NULL);
    static lv_indev_t input_device;

    lv_port_indev_init(&input_device);
    lv_indev_set_group(&input_device, lv_group_create());

    static lv_point_t valid_pos[] = {{0,0}, {0, 1}, {1,1}};
    lv_obj_t *tileview;
    tileview = lv_tileview_create(lv_scr_act(), NULL);
    lv_tileview_set_valid_positions(tileview, valid_pos, 3);
    lv_tileview_set_edge_flash(tileview, true);

    lv_obj_t * tile1 = lv_obj_create(tileview, NULL);
    lv_obj_set_size(tile1, LV_HOR_RES, LV_VER_RES);
    lv_tileview_add_element(tileview, tile1);

    /*Tile1: just a label*/
    lv_obj_t * label = lv_label_create(tile1, NULL);
    lv_label_set_text(label, "Scroll down");
    lv_obj_align(label, NULL, LV_ALIGN_CENTER, 0, 0);

    /*Tile2: a list*/
    lv_obj_t * tile2 = lv_obj_create(tileview, NULL);
    lv_obj_set_size(tile2, LV_HOR_RES, LV_VER_RES);
    lv_obj_set_pos(tile2, 0, LV_VER_RES);
    lv_tileview_add_element(tileview, tile2);

    lv_obj_t * list = lv_list_create(tile2, NULL);
    lv_obj_set_size(list, LV_HOR_RES, LV_VER_RES);
    lv_list_set_scroll_propagation(list, true);
    lv_list_set_scrollbar_mode(list, LV_SCROLLBAR_MODE_OFF);

    lv_list_add_btn(list, NULL, "One");
    lv_list_add_btn(list, NULL, "Two");
    lv_list_add_btn(list, NULL, "Three");
    lv_list_add_btn(list, NULL, "Four");
    lv_list_add_btn(list, NULL, "Five");
    lv_list_add_btn(list, NULL, "Six");
    lv_list_add_btn(list, NULL, "Seven");
    lv_list_add_btn(list, NULL, "Eight");

    /*Tile3: a button*/
    lv_obj_t * tile3 = lv_obj_create(tileview, tile1);
    lv_obj_set_pos(tile3, LV_HOR_RES, LV_VER_RES);
    lv_tileview_add_element(tileview, tile3);

    lv_obj_t * btn = lv_btn_create(tile3, NULL);
    lv_obj_align(btn, NULL, LV_ALIGN_CENTER, 0, 0);
    lv_tileview_add_element(tileview, btn);
    label = lv_label_create(btn, NULL);
    lv_label_set_text(label, "No scroll up");

Screenshot and/or video

If possible, add screenshots and/or videos about the current issue.

That’s a limitation of scroll propagation, at least in 6.x. I’m not sure if you’re using 7.0 or not - it might be worth giving that a try.

Forgot to specify that i am using 7.0.1 for this.

It was a bug and fixed it in lvgl/master

It’s a limitation because the scroll can be propagated only to other scrollable elements.