diff --git a/lv_objx/lv_list.c b/lv_objx/lv_list.c index 8accb665af..48763d6638 100644 --- a/lv_objx/lv_list.c +++ b/lv_objx/lv_list.c @@ -300,6 +300,7 @@ void lv_list_set_btn_selected(lv_obj_t * list, lv_obj_t * btn) } ext->selected_btn = btn; + ext->last_sel = btn; if(ext->selected_btn) { lv_btn_state_t s = lv_btn_get_state(ext->selected_btn); @@ -760,7 +761,7 @@ static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param) lv_group_t * g = lv_obj_get_group(list); if(lv_group_get_editing(g)) { lv_list_ext_t * ext = lv_obj_get_ext_attr(list); - if(NULL != ext->last_sel) { + if(ext->last_sel) { /* Select the last used button */ lv_list_set_btn_selected(list, ext->last_sel); } @@ -779,7 +780,7 @@ static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param) lv_list_set_btn_selected(list, last_clicked_btn); } else { lv_list_ext_t * ext = lv_obj_get_ext_attr(list); - if(NULL != ext->last_sel) { + if(ext->last_sel) { /* Select the last used button */ lv_list_set_btn_selected(list, ext->last_sel); } diff --git a/lv_objx/lv_list.h b/lv_objx/lv_list.h index 0fe0c12910..a318770821 100644 --- a/lv_objx/lv_list.h +++ b/lv_objx/lv_list.h @@ -59,8 +59,8 @@ typedef struct uint32_t size; /*the number of items(buttons) in the list*/ bool single_mode; /* whether single selected mode is enabled */ #if USE_LV_GROUP - lv_obj_t * last_sel; /* Last btn selected */ - lv_obj_t * selected_btn; + lv_obj_t * last_sel; /* The last selected button. It will be reverted when the list is focused again */ + lv_obj_t * selected_btn; /* The button is currently being selected*/ #endif } lv_list_ext_t;