lv_event.h

API reference for lv_event.h

Report on GitHub
See Also: Private HeaderThis header has a companion private implementation with internal data structures.lv_event_private.h

Functions

lv_event_desc_set_external_data

Set external data and its destructor for an event descriptor. This allows associating custom data with an event callback that will be automatically cleaned up when the event descriptor is removed or destroyed.

 
void lv_event_desc_set_external_data(lv_event_dsc_t *dsc, void *data, void(*free_cb)(void *data))
Parameters
NameTypeDescription
dsclv_event_dsc_t *pointer to an event descriptor (from lv_obj_add_event_cb)
datavoid *pointer to the external data to associate with the event descriptor
free_cbvoid(*)(void *data)function pointer to a destructor that will be called to clean up the external data. The destructor will receive the data pointer as its parameter.

Enums

lv_event_code_t

Type of event being sent to Widget

NameValueDescription
LV_EVENT_ALL0
LV_EVENT_PRESSEDInput device events Widget has been pressed
LV_EVENT_PRESSINGWidget is being pressed (sent continuously while pressing)
LV_EVENT_PRESS_LOSTWidget is still being pressed but slid cursor/finger off Widget
LV_EVENT_SHORT_CLICKEDWidget was pressed for a short period of time, then released. Not sent if scrolled.
LV_EVENT_SINGLE_CLICKEDSent for first short click within a small distance and short time
LV_EVENT_DOUBLE_CLICKEDSent for second short click within small distance and short time
LV_EVENT_TRIPLE_CLICKEDSent for third short click within small distance and short time
LV_EVENT_LONG_PRESSEDObject has been pressed for at least long_press_time. Not sent if scrolled.
LV_EVENT_LONG_PRESSED_REPEATSent after long_press_time in every long_press_repeat_time ms. Not sent if scrolled.
LV_EVENT_CLICKEDSent on release if not scrolled (regardless to long press)
LV_EVENT_RELEASEDSent in every cases when Widget has been released
LV_EVENT_SCROLL_BEGINScrolling begins. The event parameter is a pointer to the animation of the scroll. Can be modified
LV_EVENT_SCROLL_THROW_BEGIN
LV_EVENT_SCROLL_ENDScrolling ends
LV_EVENT_SCROLLScrolling
LV_EVENT_GESTUREA gesture is detected. Get gesture with lv_indev_get_gesture_dir(lv_indev_active());
LV_EVENT_KEYA key is sent to Widget. Get key with lv_indev_get_key(lv_indev_active());
LV_EVENT_ROTARYAn encoder or wheel was rotated. Get rotation count with lv_event_get_rotary_diff(e);
LV_EVENT_FOCUSEDWidget received focus
LV_EVENT_DEFOCUSEDWidget's focus has been lost
LV_EVENT_LEAVEWidget's focus has been lost but is still selected
LV_EVENT_HIT_TESTPerform advanced hit-testing
LV_EVENT_INDEV_RESETIndev has been reset
LV_EVENT_HOVER_OVERIndev hover over object
LV_EVENT_HOVER_LEAVEIndev hover leave object
LV_EVENT_COVER_CHECKDrawing events Check if Widget fully covers an area. The event parameter is lv_cover_check_info_t *.
LV_EVENT_REFR_EXT_DRAW_SIZEGet required extra draw area around Widget (e.g. for shadow). The event parameter is int32_t * to store the size.
LV_EVENT_DRAW_MAIN_BEGINStarting the main drawing phase
LV_EVENT_DRAW_MAINPerform the main drawing
LV_EVENT_DRAW_MAIN_ENDFinishing the main drawing phase
LV_EVENT_DRAW_POST_BEGINStarting the post draw phase (when all children are drawn)
LV_EVENT_DRAW_POSTPerform the post draw phase (when all children are drawn)
LV_EVENT_DRAW_POST_ENDFinishing the post draw phase (when all children are drawn)
LV_EVENT_DRAW_TASK_ADDEDAdding a draw task. The LV_OBJ_FLAG_SEND_DRAW_TASK_EVENTS flag needs to be set
LV_EVENT_VALUE_CHANGEDSpecial events Widget's value has changed (i.e. slider moved)
LV_EVENT_INSERTText has been inserted into Widget. The event data is char * being inserted.
LV_EVENT_REFRESHNotify Widget to refresh something on it (for user)
LV_EVENT_READYA process has finished
LV_EVENT_CANCELA process has been cancelled
LV_EVENT_STATE_CHANGEDThe state of the widget changed
LV_EVENT_CREATEOther events Object is being created
LV_EVENT_DELETEObject is being deleted
LV_EVENT_CHILD_CHANGEDChild was removed, added, or its size, position were changed
LV_EVENT_CHILD_CREATEDChild was created, always bubbles up to all parents
LV_EVENT_CHILD_DELETEDChild was deleted, always bubbles up to all parents
LV_EVENT_SCREEN_UNLOAD_STARTA screen unload started, fired immediately when scr_load is called
LV_EVENT_SCREEN_LOAD_STARTA screen load started, fired when the screen change delay is expired
LV_EVENT_SCREEN_LOADEDA screen was loaded
LV_EVENT_SCREEN_UNLOADEDA screen was unloaded
LV_EVENT_SIZE_CHANGEDObject coordinates/size have changed
LV_EVENT_STYLE_CHANGEDObject's style has changed
LV_EVENT_LAYOUT_CHANGEDA child's position position has changed due to a layout recalculation
LV_EVENT_GET_SELF_SIZEGet internal size of a widget
LV_EVENT_INVALIDATE_AREAEvents of optional LVGL components An area is invalidated (marked for redraw). lv_event_get_param(e) returns a pointer to an lv_area_t object with the coordinates of the area to be invalidated. The area can be freely modified if needed to adapt it a special requirement of the display. Usually needed with monochrome displays to invalidate N x 8 rows or columns in one pass.
LV_EVENT_RESOLUTION_CHANGEDSent when the resolution changes due to lv_display_set_resolution() or lv_display_set_rotation().
LV_EVENT_COLOR_FORMAT_CHANGEDSent as a result of any call to lv_display_set_color_format().
LV_EVENT_REFR_REQUESTSent when something happened that requires redraw.
LV_EVENT_REFR_STARTSent before a refreshing cycle starts. Sent even if there is nothing to redraw.
LV_EVENT_REFR_READYSent when refreshing has been completed (after rendering and calling flush callback). Sent even if no redraw happened.
LV_EVENT_RENDER_STARTSent just before rendering begins.
LV_EVENT_RENDER_READYSent after rendering has been completed.
LV_EVENT_FLUSH_STARTSent before flush callback is called.
LV_EVENT_FLUSH_FINISHSent after flush callback call has returned.
LV_EVENT_FLUSH_WAIT_STARTSent before flush wait callback is called.
LV_EVENT_FLUSH_WAIT_FINISHSent after flush wait callback call has returned.
LV_EVENT_SYNC_STARTSent before sync callback is called.
LV_EVENT_SYNC_FINISHSent after sync callback call has returned.
LV_EVENT_SYNC_WAIT_STARTSent before sync wait callback is called.
LV_EVENT_SYNC_WAIT_FINISHSent after sync wait callback call has returned.
LV_EVENT_UPDATE_LAYOUT_COMPLETEDSent after layout update completes
LV_EVENT_VSYNC
LV_EVENT_VSYNC_REQUEST
LV_EVENT_TRANSLATION_LANGUAGE_CHANGEDSent when the translation language changed.
LV_EVENT_LAST
LV_EVENT_PREPROCESS0x8000Number of default events
LV_EVENT_MARKED_DELETING0x10000This is a flag that can be set with an event so it's processed before the class default event processing
Used by 21 functions
  • lv_obj_add_screen_load_event — param trigger
  • lv_obj_add_screen_create_event — param trigger
  • lv_obj_add_play_timeline_event — param trigger
  • lv_obj_send_event — param event_code
  • lv_obj_add_event_cb — param filter
  • lv_obj_add_subject_increment_event — param trigger
  • lv_obj_add_subject_toggle_event — param trigger
  • lv_obj_add_subject_set_int_event — param trigger
  • lv_obj_add_subject_set_float_event — param trigger
  • lv_obj_add_subject_set_string_event — param trigger
  • lv_display_add_event_cb — param filter
  • lv_display_send_event — param code
  • lv_draw_unit_send_event — param code
  • lv_indev_add_event_cb — param filter
  • lv_indev_send_event — param code
  • lv_freetype_outline_add_event — param filter
  • lv_gltf_model_node_add_event_cb — param filter_list
  • lv_gltf_model_node_add_event_cb_with_world_position — param filter_list
  • lv_event_add — param filter
  • lv_event_code_get_name — param code
  • lv_event_push_and_send — param code

Structs

struct

lv_event_list_t

MemberTypeDescription
arraylv_array_t
is_traversinguint8_tTrue: the list is being nested traversed
has_marked_deletinguint8_tTrue: the list has marked deleting objects when some of events are marked as deleting
Used by 8 functions
  • lv_event_send — param list
  • lv_event_add — param list
  • lv_event_remove_dsc — param list
  • lv_event_get_count — param list
  • lv_event_get_dsc — param list
  • lv_event_remove — param list
  • lv_event_remove_all — param list
  • lv_event_push_and_send — param event_list

Typedefs

lv_event_cb_t

 
typedef void(* lv_event_cb_t) (lv_event_t *e)
Used by 13 functions
  • lv_obj_add_event_cb — param event_cb
  • lv_obj_remove_event_cb — param event_cb
  • lv_obj_remove_event_cb_with_user_data — param event_cb
  • lv_display_add_event_cb — param event_cb
  • lv_display_remove_event_cb_with_user_data — param event_cb
  • lv_display_register_vsync_event — param event_cb
  • lv_display_unregister_vsync_event — param event_cb
  • lv_indev_add_event_cb — param event_cb
  • lv_indev_remove_event_cb_with_user_data — param event_cb
  • lv_freetype_outline_add_event — param event_cb
  • lv_gltf_model_node_add_event_cb — param cb
  • lv_gltf_model_node_add_event_cb_with_world_position — param cb
  • lv_event_add — param cb

Dependencies

How is this guide?

Last updated on

On this page