Skip to content
On this page

Events

For more detailed information, please refer to this link:
https://docs.lvgl.io/8.3/overview/event.html

Triggering Events

Common Widget Events
LV_EVENT_PRESSEDObject is pressed
LV_EVENT_PRESSINGContinuously called while the object is pressed
LV_EVENT_PRESS_LOSTCursor/finger slides away from the object while still pressing it
LV_EVENT_SHORT_CLICKEDObject is short-clicked
LV_EVENT_LONG_PRESSEDObject is long-pressed
LV_EVENT_LONG_PRESSED_REPEATCalled every millisecond while the object is long-pressed
LV_EVENT_CLICKEDObject is released after being pressed without scrolling
LV_EVENT_RELEASEDObject is released, including scrolling
LV_EVENT_SCROLL_BEGINScrolling starts
LV_EVENT_SCROLL_ENDScrolling ends
LV_EVENT_SCROLLObject is being scrolled
LV_EVENT_KEYKey is sent to the object from input devices like keyboard encoders
LV_EVENT_FOCUSEDObject is focused
LV_EVENT_DEFOCUSEDObject is defocused
LV_EVENT_LEAVEObject is no longer focused but remains selected
LV_EVENT_HIT_TESTAdvanced hit test is performed
LV_EVENT_VALUE_CHANGEDObject's value has changed
Screen-Specific Events
LV_EVENT_SCREEN_UNLOAD_STARTScreen unload starts
LV_EVENT_SCREEN_LOAD_STARTScreen load starts
LV_EVENT_SCREEN_LOADEDScreen has loaded
LV_EVENT_SCREEN_UNLOADEDScreen has unloaded
LV_EVENT_GESTURE_LEFTGesture detected: left
LV_EVENT_GESTURE_RIGHTGesture detected: right
LV_EVENT_GESTURE_TOPGesture detected: up
LV_EVENT_GESTURE_BOTTOMGesture detected: down

Screen Loading

Screen Load Animations
LV_SCR_LOAD_ANIM_NONENo animation when loading screen
LV_SCR_LOAD_ANIM_OVER_LEFTNew screen slides in from the right
LV_SCR_LOAD_ANIM_OVER_RIGHTNew screen slides in from the left
LV_SCR_LOAD_ANIM_OVER_TOPNew screen slides in from the bottom
LV_SCR_LOAD_ANIM_OVER_BOTTOMNew screen slides in from the top
LV_SCR_LOAD_ANIM_MOVE_LEFTNew screen slides in from the right while the old screen slides out to the left
LV_SCR_LOAD_ANIM_MOVE_RIGHTNew screen slides in from the left while the old screen slides out to the right
LV_SCR_LOAD_ANIM_MOVE_TOPNew screen slides in from the bottom while the old screen slides out to the top
LV_SCR_LOAD_ANIM_MOVE_BOTTOMNew screen slides in from the top while the old screen slides out to the bottom
LV_SCR_LOAD_ANIM_FADE_INNew screen fades in while the old screen fades out
LV_SCR_LOAD_ANIM_FADE_ONNew screen fades in while the old screen fades out
LV_SCR_LOAD_ANIM_FADE_OUTOld screen fades out
LV_SCR_LOAD_ANIM_OUT_LEFTOld screen slides out to the left
LV_SCR_LOAD_ANIM_OUT_RIGHTOld screen slides out to the right
LV_SCR_LOAD_ANIM_OUT_TOPOld screen slides out to the top
LV_SCR_LOAD_ANIM_OUT_BOTTOMOld screen slides out to the bottom

States

Adding States
LV_STATE_DEFAULTNormal release state
LV_STATE_CHECKEDChecked state
LV_STATE_FOCUSEDFocused state
LV_STATE_FOCUS_KEYKeyboard focused state
LV_STATE_EDITEDEdited state
LV_STATE_HOVEREDHovered state (not supported)
LV_STATE_PRESSEDPressed state
LV_STATE_SCROLLEDScrolled state
LV_STATE_DISABLEDDisabled state

Widget Events

  1. Select "Interactions" from the right navigation bar and add the corresponding trigger event.
  2. Choose the widget that needs the event modification, and enter the corresponding event design panel.
  3. Modify the value that needs to be triggered. If this item is highlighted, it means it has been set. If it is gray, it means this item is not changed in the event.
  4. If this setting is not needed, click the clear mark in the upper right corner of the corresponding area.

Example

Below is an example of common menu button event switching, showing the effect:

8ms_12.gif

The steps to add an event can be referenced below:

8ms_11.gif

Page Load Events

  1. Select "Interactions" from the right navigation bar and add the corresponding trigger event.
  2. Choose the event that needs to trigger the page load, select the page to load, and whether to automatically delete the old page.
  3. Check the corresponding cancel page load event.

Example

Below is an example of common left-right swipe page switch events, showing the effect:

8ms_14.gif

The steps to add an event can be referenced below:

8ms_13.gif