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

fix(dropdown) forget the selected option on encoder longpress

This commit is contained in:
Gabor Kiss-Vamosi 2021-06-23 21:53:16 +02:00
parent 2df12827dd
commit e66b935061

View File

@ -615,10 +615,14 @@ static void lv_dropdown_event(const lv_obj_class_t * class_p, lv_event_t * e)
/*Encoders need special handling*/ /*Encoders need special handling*/
if(indev_type == LV_INDEV_TYPE_ENCODER) { if(indev_type == LV_INDEV_TYPE_ENCODER) {
/*Open the list if editing*/ /*Open the list if editing*/
if(editing) lv_dropdown_open(obj); if(editing) {
lv_dropdown_open(obj);
}
/*Close the list if navigating*/ /*Close the list if navigating*/
else else {
dropdown->sel_opt_id = dropdown->sel_opt_id_orig;
lv_dropdown_close(obj); lv_dropdown_close(obj);
}
} }
} }
else if(code == LV_EVENT_DEFOCUSED || code == LV_EVENT_LEAVE) { else if(code == LV_EVENT_DEFOCUSED || code == LV_EVENT_LEAVE) {