feat(events): add event trickle mechanism to propagate events to children (#8415)
Arduino Lint / lint (push) Has been cancelled
Build Examples with C++ Compiler / build-examples (push) Has been cancelled
MicroPython CI / Build esp32 port (push) Has been cancelled
MicroPython CI / Build rp2 port (push) Has been cancelled
MicroPython CI / Build stm32 port (push) Has been cancelled
MicroPython CI / Build unix port (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_NORMAL_8BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_SDL - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_VG_LITE - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_VG_LITE - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_VG_LITE - gcc - Windows (push) Has been cancelled
C/C++ CI / Build ESP IDF ESP32S3 (push) Has been cancelled
C/C++ CI / Run tests with 32bit build (push) Has been cancelled
C/C++ CI / Run tests with 64bit build (push) Has been cancelled
BOM Check / bom-check (push) Has been cancelled
Verify that lv_conf_internal.h matches repository state / verify-conf-internal (push) Has been cancelled
Verify the widget property name / verify-property-name (push) Has been cancelled
Verify code formatting / verify-formatting (push) Has been cancelled
Compare file templates with file names / template-check (push) Has been cancelled
Build docs / build-and-deploy (push) Has been cancelled
Test API JSON generator / Test API JSON (push) Has been cancelled
Check Makefile / Build using Makefile (push) Has been cancelled
Check Makefile for UEFI / Build using Makefile for UEFI (push) Has been cancelled
Performance Tests CI / Perf Tests OPTIONS_TEST_PERF_32B - Ubuntu (push) Has been cancelled
Performance Tests CI / Perf Tests OPTIONS_TEST_PERF_64B - Ubuntu (push) Has been cancelled
Port repo release update / run-release-branch-updater (push) Has been cancelled
Verify Font License / verify-font-license (push) Has been cancelled
Verify Kconfig / verify-kconfig (push) Has been cancelled

Co-authored-by: Gauthier Provost <gpr@interel.com>
This commit is contained in:
Gauthier Provost
2025-07-03 19:20:41 +08:00
committed by GitHub
parent dec36ddb69
commit 6ec45fa613
15 changed files with 234 additions and 2 deletions
+5
View File
@@ -22,6 +22,11 @@ Event bubbling
.. lv_example:: event/lv_example_event_bubble
:language: c
Event trickle-down
------------------
.. lv_example:: event/lv_example_event_trickle
:language: c
Draw event
----------
.. lv_example:: event/lv_example_event_draw
+1
View File
@@ -29,6 +29,7 @@ void lv_example_event_click(void);
void lv_example_event_streak(void);
void lv_example_event_button(void);
void lv_example_event_bubble(void);
void lv_example_event_trickle(void);
void lv_example_event_draw(void);
/**********************
+37
View File
@@ -0,0 +1,37 @@
#include "../lv_examples.h"
#if LV_BUILD_EXAMPLES && LV_USE_FLEX
/**
* Demonstrate event trickle
*/
void lv_example_event_trickle(void)
{
lv_obj_t * cont = lv_obj_create(lv_screen_active());
lv_obj_set_size(cont, 290, 200);
lv_obj_center(cont);
lv_obj_set_flex_flow(cont, LV_FLEX_FLOW_ROW_WRAP);
static lv_style_t style_black;
lv_style_init(&style_black);
lv_style_set_text_color(&style_black, lv_color_white());
lv_style_set_bg_color(&style_black, lv_color_black());
/*Enable event trickle-down on the container*/
lv_obj_add_flag(cont, LV_OBJ_FLAG_EVENT_TRICKLE);
lv_obj_add_style(cont, &style_black, LV_STATE_PRESSED);
uint32_t i;
for(i = 0; i < 9; i++) {
lv_obj_t * subcont = lv_obj_create(cont);
lv_obj_set_size(subcont, 70, 50);
lv_obj_t * label = lv_label_create(subcont);
lv_label_set_text_fmt(label, "%" LV_PRIu32, i);
/*Add style to the label when clicked*/
lv_obj_add_style(subcont, &style_black, LV_STATE_FOCUSED);
}
}
#endif