mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
fix(list): fix removing list elements
remove the button from last_sel_btn adn act_sel_btn related to #1895
This commit is contained in:
parent
63dfe9e8e3
commit
20fef93fea
@ -250,9 +250,13 @@ bool lv_list_remove(const lv_obj_t * list, uint16_t index)
|
||||
{
|
||||
LV_ASSERT_OBJ(list, LV_OBJX_NAME);
|
||||
|
||||
lv_list_ext_t * ext = lv_obj_get_ext_attr(list);
|
||||
uint16_t count = 0;
|
||||
lv_obj_t * e = lv_list_get_next_btn(list, NULL);
|
||||
while(e != NULL) {
|
||||
if(e == ext->last_sel_btn) ext->last_sel_btn = NULL;
|
||||
if(e == ext->act_sel_btn) ext->act_sel_btn = NULL;
|
||||
|
||||
if(count == index) {
|
||||
lv_obj_del(e);
|
||||
return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user