mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
lv_list_set_selected_btn fix
This commit is contained in:
parent
fabd551e2a
commit
f5b8dd17b8
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user