1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-28 07:03:00 +08:00

Fix ddlist controlled via keyboard

The selected option is tracked correctly when scrolling through the
dropdown list via keyboard
This commit is contained in:
Josh McAtee 2018-01-30 11:58:40 -08:00
parent aad9f76a39
commit cab6ce93d6

View File

@ -515,7 +515,7 @@ static lv_res_t lv_ddlist_signal(lv_obj_t * ddlist, lv_signal_t sign, void * par
if(c == LV_GROUP_KEY_RIGHT || c == LV_GROUP_KEY_DOWN) { if(c == LV_GROUP_KEY_RIGHT || c == LV_GROUP_KEY_DOWN) {
if(ext->sel_opt_id + 1 < ext->option_cnt) { if(ext->sel_opt_id + 1 < ext->option_cnt) {
ext->sel_opt_id ++; ext->sel_opt_id ++;
lv_obj_invalidate(ddlist); lv_ddlist_pos_current_option(ddlist);
if(ext->action != NULL) { if(ext->action != NULL) {
ext->action(ddlist); ext->action(ddlist);
} }
@ -523,7 +523,7 @@ static lv_res_t lv_ddlist_signal(lv_obj_t * ddlist, lv_signal_t sign, void * par
} else if(c == LV_GROUP_KEY_LEFT || c == LV_GROUP_KEY_UP) { } else if(c == LV_GROUP_KEY_LEFT || c == LV_GROUP_KEY_UP) {
if(ext->sel_opt_id > 0) { if(ext->sel_opt_id > 0) {
ext->sel_opt_id --; ext->sel_opt_id --;
lv_obj_invalidate(ddlist); lv_ddlist_pos_current_option(ddlist);
if(ext->action != NULL) { if(ext->action != NULL) {
ext->action(ddlist); ext->action(ddlist);
} }