User data (context) for event callbacks

I use LittelvGL in mixed C/C++ projects. It would be really great if the event callbacks can have optional user data (void*) like the tasks. This way you can create the callback as a static function inside a class and pass the object pointer (this pointer) to the event so that you can access the class object inside the callback.

1 Like

This should already be doable. Event handlers are passed the object (lv_obj_t *) and you can store user data on that with lv_obj_set_user_data.

4 Likes