Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix(tabview) send LV_EVENT_VALUE_CHANGED only once
Fixes #2377
  • Loading branch information
kisvegabor committed Jul 16, 2021
1 parent 04c515a commit 933d282
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/extra/widgets/tabview/lv_tabview.c
Expand Up @@ -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)
Expand All @@ -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*/

0 comments on commit 933d282

Please sign in to comment.