xsola
July 26, 2019, 8:11am
1
Hello,
I’m using a drop down list with a lot of options. I’ve seen that if there are more than 51 options, the first option disappears when I select another option or I scroll the list.
I would appreciate if someone could tell me how to fix it.
Thank you very much.
Hi,
Can yo reproduce it in the simulator and send the code?
xsola
July 29, 2019, 11:13am
3
Yes, I can reproduce it in the simulator; I send the code.
If you change the selected option in the list, the first item (“01”) disappears.
The same happens if you move the list down and then go back up.
Thank you very much.
static void ddlist_example(void)
{
/*Create a drop down list*/
lv_obj_t * ddlist = lv_ddlist_create(lv_scr_act(), NULL);
lv_ddlist_set_options(ddlist, "01\n" "02\n" "03\n" "04\n" "05\n" "06\n" "07\n" "08\n" "09\n" "10\n"
"11\n" "12\n" "13\n" "14\n" "15\n" "16\n" "17\n" "18\n" "19\n" "20\n"
"21\n" "22\n" "23\n" "24\n" "25\n" "26\n" "27\n" "28\n" "29\n" "30\n"
"31\n" "32\n" "33\n" "34\n" "35\n" "36\n" "37\n" "38\n" "39\n" "40\n"
"41\n" "42\n" "43\n" "44\n" "45\n" "46\n" "47\n" "48\n" "49\n" "50\n"
"51\n" "52\n" "53\n" "54\n" "55\n" "56\n" "57\n" "58\n" "59\n" "60" );
lv_ddlist_set_fix_width(ddlist, 150);
lv_ddlist_set_fix_height(ddlist, 200);
lv_ddlist_set_stay_open(ddlist, true);
lv_ddlist_open(ddlist, LV_ANIM_OFF);
lv_ddlist_set_selected(ddlist, 3);
lv_obj_align(ddlist, NULL, LV_ALIGN_IN_TOP_MID, 0, 20);
}
int main(int argc, char ** argv)
{
(void) argc; /*Unused*/
(void) argv; /*Unused*/
/*Initialize LittlevGL*/
lv_init();
/*Initialize the HAL (display, input devices, tick) for LittlevGL*/
hal_init();
ddlist_example();
while(1) {
/* Periodically call the lv_task handler.
* It could be done in a timer interrupt or an OS task too.*/
lv_task_handler();
usleep(5 * 1000);
#ifdef SDL_APPLE
SDL_Event event;
while(SDL_PollEvent(&event)) {
#if USE_MOUSE != 0
mouse_handler(&event);
#endif
#if USE_KEYBOARD
keyboard_handler(&event);
#endif
#if USE_MOUSEWHEEL != 0
mousewheel_handler(&event);
#endif
}
#endif
}
return 0;
}
xsola:
ddlist_example();
I’ve fixed it in master
.
I’ve updated your post to format the code. Next time please use this formatting for better readability:
```c
your code
```