How to get the caller object in callback function?

Description

For now I have a bunch of “identical” callback functions for a bunch of buttons.
I am trying to have all buttons of a group use 1 callback.

in the callback, I can get the user_data by:
int user = (int)lv_event_get_user_data(e);

but I cannot get the caller object by:
lv_obj_t * btn = lv_event_get_target(e);
it doesn’t compile, and I do not understand what it’s trying to tell me :confused:
a value of type “void *” cannot be used to initialize an entity of type “lv_obj_t *”

What MCU/Processor/Board and compiler are you using?

ESP32 / CYD
VScode/Platformio/Arduino

What LVGL version are you using?

9.1

What do you want to achieve?

I want to read the status of toggle buttons in the callback function, therefore need a pointer to the calling button.

try to use

lv_obj_t * btn = (lv_obj_t *)lv_event_get_target(e);

Thanks heaps glory-man.
It works. Not very intuitive.