Description
List focus doesn’t work, but it works with drop down
What MCU/Processor/Board and compiler are you using?
nRF52
What do you experience?
I wrote the code from sniped 1 and with the 4 buttons on the PCB I can scroll through the drop down, select or cancel.
Then I changed the code to sniped 2 by removing the drop down and replacing it with a list and now I cannot scroll through the list with the buttons. I think the list is not focus now, wright? How to get it working? Thank you!
What do you expect?
Navigate through the list
Code to reproduce
Sniped 1:
lv_group_t * g = lv_group_create();
lv_indev_set_group(my_indev, g);
//Create a drop down list
lv_obj_t * ddlist = lv_dropdown_create(lv_scr_act(), NULL);
lv_dropdown_set_options(ddlist,
"Apple\n"
"Banana\n"
"Orange\n"
"Melon\n"
"Grape\n"
"Raspberry");
lv_obj_set_width(ddlist, 200);
//lv_ddlist_set_draw_arrow(ddlist, true);
lv_obj_align(ddlist, NULL, LV_ALIGN_IN_TOP_MID, -4, 0);
//lv_obj_set_event_cb(ddlist, event_handler);
lv_group_add_obj(g, ddlist);
Sniped 2:
lv_group_t * g = lv_group_create();
lv_indev_set_group(my_indev, g);
lv_obj_t * list1 = lv_list_create(lv_scr_act(), NULL);
lv_obj_set_size(list1, LV_HOR_RES_MAX-8, LV_VER_RES_MAX);
lv_obj_align(list1, NULL, LV_ALIGN_CENTER, -4, 0);
//Add buttons to the list
lv_obj_t * list_btn;
list_btn = lv_list_add_btn(list1, LV_SYMBOL_FILE, "New");
//lv_obj_set_event_cb(list_btn, event_handler);
list_btn = lv_list_add_btn(list1, LV_SYMBOL_DIRECTORY, "Open");
//lv_obj_set_event_cb(list_btn, event_handler);
list_btn = lv_list_add_btn(list1, LV_SYMBOL_CLOSE, "Delete");
//lv_obj_set_event_cb(list_btn, event_handler);
list_btn = lv_list_add_btn(list1, LV_SYMBOL_EDIT, "Edit");
//lv_obj_set_event_cb(list_btn, event_handler);
list_btn = lv_list_add_btn(list1, LV_SYMBOL_SAVE, "Save");
//lv_obj_set_event_cb(list_btn, event_handler);
list_btn = lv_list_add_btn(list1, LV_SYMBOL_BELL, "Notify");
//lv_obj_set_event_cb(list_btn, event_handler);
list_btn = lv_list_add_btn(list1, LV_SYMBOL_BATTERY_FULL, "Battery");
//lv_obj_set_event_cb(list_btn, event_handler);
lv_group_add_obj(g, list1);
Screenshot and/or video
n/a