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

fix(tabview) send LV_EVENT_VALUE_CHANGED only once

Fixes #2377
This commit is contained in:
Gabor Kiss-Vamosi 2021-07-16 12:16:10 +02:00
parent 04c515adac
commit 933d2829ac

View File

@ -271,8 +271,6 @@ static void btns_value_changed_event_cb(lv_event_t * e)
lv_obj_t * tv = lv_obj_get_parent(btns);
uint32_t id = lv_btnmatrix_get_selected_btn(btns);
lv_tabview_set_act(tv, id, LV_ANIM_ON);
lv_event_send(tv, LV_EVENT_VALUE_CHANGED, NULL);
}
static void cont_scroll_end_event_cb(lv_event_t * e)
@ -295,8 +293,11 @@ static void cont_scroll_end_event_cb(lv_event_t * e)
else t = (p.x + w/ 2) / w;
if(t < 0) t = 0;
bool new_tab = false;
if(t != lv_tabview_get_tab_act(tv)) new_tab = true;
lv_tabview_set_act(tv, t, LV_ANIM_ON);
lv_event_send(tv, LV_EVENT_VALUE_CHANGED, NULL);
if(new_tab) lv_event_send(tv, LV_EVENT_VALUE_CHANGED, NULL);
}
}
#endif /*LV_USE_TABVIEW*/