LVGL 8 - Button object

Hello!

LVGL 8 seems great but also quite a bit different from V7.
Event handlers in V7 had an object so that you could do if(object == MY_BUTTON). This seems to be removed? I’ve studied the documentation for Buttons in V8 but I can’t seem to figure it out.

I dont want a seperate event handler for each button, that seems like a waste of code.

Appreciate your input! :slight_smile:

Are you looking for object pointer from lv_event_t?
then lv_event_get_target will do the job.
lv_obj_t *obj = lv_event_get_target(e);

1 Like

This is exactly what I was looking for, works like a charm just like V7. Thanks!