Add ddlist in a page

Description

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

I am using K210 from kendryte. I am using v6.02

What do you experience?

I’ve created a page and then added two ddlist in the Page. When I press the second ddlist I expect that the page scrollbar move to the ddlist so I can see all the ddlist options but this doesn’t happen and I need to scroll down manually

What do you expect?

Code to reproduce

void test_ddlist_in_page() {

  lv_obj_t * value_obj = NULL;
  lv_obj_t *prev_value_obj = NULL;

  lv_obj_t * bg = lv_page_create(lv_scr_act(), NULL);
//  lv_obj_set_pos(bg, PADDING_BORDER, lv_obj_get_y(obj)+ PADDING_BORDER);
  //lv_page_set_scrl_fit4(bg, LV_FIT_FILL, LV_FIT_FILL, LV_FIT_FLOOD,LV_FIT_FILL);
  lv_obj_set_size(bg, LV_HOR_RES_MAX - 120, 150);
  lv_page_set_style(bg, LV_PAGE_STYLE_SCRL, &lv_style_transp_tight);
  lv_page_set_style(bg, LV_PAGE_STYLE_BG, &lv_style_transp_tight);
  lv_obj_align(bg, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 0);

  value_obj = lv_ddlist_create(bg, NULL);
  lv_ddlist_set_options(value_obj, "320x240\n480x320\n640x480\n800x600\n1280x720\n1920x1080\n1280x960\n2592x1944");
  lv_ddlist_set_fix_width(value_obj, 160);
  lv_ddlist_set_fix_height(value_obj, 150);
  lv_ddlist_set_draw_arrow(value_obj, true);
  lv_obj_align(value_obj, NULL, LV_ALIGN_IN_TOP_LEFT, 10, 10);

  prev_value_obj = value_obj;
  value_obj = lv_ddlist_create(bg, NULL);
  lv_ddlist_set_options(value_obj, "auto\nsunny\noffice\ncloudy\nhome");
  lv_ddlist_set_fix_width(value_obj, 150);
  lv_ddlist_set_fix_height(value_obj, 150);
  lv_ddlist_set_draw_arrow(value_obj, true);
  lv_obj_align(value_obj, prev_value_obj, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 30);

}

Screenshot and/or video

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

It’s really an issue and there is no simple solution for it in v6.

A possible workaround is when the ddlist is clicked create an lv_task which period is the same as the ddlist’s animation time. Also make the lv_task to run once with lv_task_once(task). In the task, you can call lv_page_focus when the ddlist already opened.

In v7 the ddlist will work differently. It will create a scrollable page with the options on top of the other objects. You can see it here (it’s on the “Selectors” tab)