How create custom event on lvgl 9

hi, today i just tried to create a custom event like in document, but when compiling i get error:

“…/user/gui/screen.c:10:30: error: initializer element is not constant”

anyone know how to fix it?

You can’t initialize a global variable with a non-constant value in C. Also, I discovered that I have to assign it after lv_init(), which I don’t think was the case in LVGL 8.x.x. Try it this way:

UINT32_t MY_EVENT_1;

...more code here...

lv_init();
MY_EVENT_1 = lv_event_register_id();
1 Like

you are right i will go back to school and learn some C basics :smiling_face_with_tear: :smiling_face_with_tear: :smiling_face_with_tear:

1 Like