In the example `LV_EVENT_CLICKED` means that only the click event will call `my_event_cb`. See the [list of event codes](#event-codes) for all the options.
`LV_EVENT_ALL` can be used to receive all the events.
The last parameter of `lv_obj_add_event_cb` is a pointer to any custom data that will be available in the event. It will be described later in more detail.
Events can be removed from an object with the `lv_obj_remove_event_cb(obj, event_cb)` function or `lv_obj_remove_event_dsc(obj, event_dsc)`. `event_dsc` is a pointer returned by `lv_obj_add_event_cb`.
-`LV_EVENT_PRESSING` The object is being pressed (called continuously while pressing)
-`LV_EVENT_PRESS_LOST` The object is still being pressed but slid cursor/finger off of the object
-`LV_EVENT_SHORT_CLICKED` The object was pressed for a short period of time, then released it. Not called if scrolled.
-`LV_EVENT_LONG_PRESSED` Object has been pressed for at least the `long_press_time` specified in the input device driver. Not called if scrolled.
-`LV_EVENT_LONG_PRESSED_REPEAT` Called after `long_press_time` in every `long_press_repeat_time` ms. Not called if scrolled.
-`LV_EVENT_CLICKED` Called on release if the object not scrolled (regardless to long press)
-`LV_EVENT_RELEASED` Called in every cases when the object has been released
-`LV_EVENT_SCROLL_BEGIN` Scrolling begins
-`LV_EVENT_SCROLL_END` Scrolling ends
-`LV_EVENT_SCROLL` The object was scrolled
-`LV_EVENT_GESTURE` A gesture is detected. Get the gesture with `lv_indev_get_gesture_dir(lv_indev_get_act());`
-`LV_EVENT_KEY` A key is sent to the object. Get the key with `lv_indev_get_key(lv_indev_get_act());`
-`LV_EVENT_FOCUSED` The object is focused
-`LV_EVENT_DEFOCUSED` The object is defocused
-`LV_EVENT_LEAVE` The object is defocused but still selected
-`LV_EVENT_HIT_TEST` Perform advanced hit-testing
### Drawing events
-`LV_EVENT_COVER_CHECK` Check if the object fully covers an area. The event parameter is `lv_cover_check_info_t *`.
-`LV_EVENT_REFR_EXT_DRAW_SIZE` Get the required extra draw area around the object (e.g. for shadow). The event parameter is `lv_coord_t *` to store the size. Overwrite it only with a larger value.
-`LV_EVENT_DRAW_MAIN_BEGIN` Starting the main drawing phase.
-`LV_EVENT_DRAW_MAIN` Perform the main drawing
-`LV_EVENT_DRAW_MAIN_END` Finishing the main drawing phase
-`LV_EVENT_DRAW_POST_BEGIN` Starting the post draw phase (when all children are drawn)
-`LV_EVENT_DRAW_POST` Perform the post draw phase (when all children are drawn)
-`LV_EVENT_DRAW_POST_END` Finishing the post draw phase (when all children are drawn)
`lv_event_t` is the only parameter passed to event callback and it contains all the data about the event. The following values can be get from it:
-`lv_event_get_code(e)` get the event code
-`lv_event_get_target(e)` get the object to which the event is sent
-`lv_event_get_original_target(e)` get the object to which the event is sent originally sent (different from `lv_event_get_target` if [event bubbling](event-bubbling) is enabled)
-`lv_event_get_user_data(e)` get the pointer passed as the last parameter of `lv_obj_add_event_cb`.
-`lv_event_get_param(e)` get the parameter passed as the last parameter of `lv_event_send`
If `lv_obj_add_flag(obj, LV_OBJ_FLAG_EVENT_BUBBLE)` is enabled all events will be sent to the object's parent too. If the parent also has `LV_OBJ_FLAG_EVENT_BUBBLE` enabled the event will be sent to its parent too, and so on.
The *target* parameter of the event is always the current target object, not the original object. To get the original target call `lv_event_get_original_target(e)` in the event handler.