fix(tabview): emit LV_EVENT_VALUE_CHANGED on header-button taps (#8537)

This commit is contained in:
Bruno Silva
2025-07-29 14:47:00 +02:00
committed by GitHub
parent a676258b38
commit 07acea0480
+16 -1
View File
@@ -305,8 +305,23 @@ static void button_clicked_event_cb(lv_event_t * e)
lv_obj_t * button = lv_event_get_current_target(e);
lv_obj_t * tv = lv_obj_get_parent(lv_obj_get_parent(button));
int32_t idx = lv_obj_get_index_by_type(button, &lv_button_class);
if(tv == NULL) return;
/* Remember currently active tab before the click */
uint32_t prev_idx = lv_tabview_get_tab_active(tv);
/* Index of the button that was clicked */
uint32_t idx = lv_obj_get_index_by_type(button, &lv_button_class);
/* Switch to the requested tab */
lv_tabview_set_active(tv, idx, LV_ANIM_OFF);
/* If the tab really changed, notify listeners just like the
* swipe/scroll handler does. */
if(prev_idx != idx) {
lv_obj_send_event(tv, LV_EVENT_VALUE_CHANGED, NULL);
}
}
static void cont_scroll_end_event_cb(lv_event_t * e)