当前位置:网站首页>[lvgl events] event code
[lvgl events] event code
2022-07-28 14:03:00 【Like warm know cold】
Click on 、 slide 、 Input 、 Changes in numbers and so on can trigger events . Events are responses to different operations .
Recently I saw the configuration screen , This thing seems to be quite simple to develop !! Ha ha ha !! End of study LVGL Take a look at this .
First statement : This article is for your reference ! There will inevitably be negligence !
Event code
Officials divided the incident into several groups :
- Input device events( input device )
- Drawing events( mapping )
- Other events( other )
- Special events( special )
- Custom events( User customization )
All objects (such as Buttons/Labels/Sliders etc.) regardless their type receive the Input device, Drawing and Other events.
All objects ( Button 、 label 、 Slider, etc ) Will receive Input device、Drawing、Other event .
However, the Special events are specific to a particular widget type.
Special events are used for specific widgets .
The source code of the event
route :lvgl\src\core\lv_event.h
/**
* Type of event being sent to the object.
*/
typedef enum {
LV_EVENT_ALL = 0,
/** Input device events*/
LV_EVENT_PRESSED, /**< The object has been pressed*/
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 `long_press_time`. 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 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. The event parameter is a pointer to the animation of the scroll. Can be modified*/
LV_EVENT_SCROLL_END, /**< Scrolling ends*/
LV_EVENT_SCROLL, /**< Scrolling*/
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.*/
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_DRAW_PART_BEGIN, /**< Starting to draw a part. The event parameter is `lv_obj_draw_dsc_t *`. */
LV_EVENT_DRAW_PART_END, /**< Finishing to draw a part. The event parameter is `lv_obj_draw_dsc_t *`. */
/** Special events*/
LV_EVENT_VALUE_CHANGED, /**< The object's value has changed (i.e. slider moved)*/
LV_EVENT_INSERT, /**< A text is inserted to the object. The event data is `char *` being inserted.*/
LV_EVENT_REFRESH, /**< Notify the object to refresh something on it (for the user)*/
LV_EVENT_READY, /**< A process has finished*/
LV_EVENT_CANCEL, /**< A process has been cancelled */
/** Other events*/
LV_EVENT_DELETE, /**< Object is being deleted*/
LV_EVENT_CHILD_CHANGED, /**< Child was removed, added, or its size, position were changed */
LV_EVENT_CHILD_CREATED, /**< Child was created, always bubbles up to all parents*/
LV_EVENT_CHILD_DELETED, /**< Child was deleted, always bubbles up to all parents*/
LV_EVENT_SCREEN_UNLOAD_START, /**< A screen unload started, fired immediately when scr_load is called*/
LV_EVENT_SCREEN_LOAD_START, /**< A screen load started, fired when the screen change delay is expired*/
LV_EVENT_SCREEN_LOADED, /**< A screen was loaded*/
LV_EVENT_SCREEN_UNLOADED, /**< A screen was unloaded*/
LV_EVENT_SIZE_CHANGED, /**< Object coordinates/size have changed*/
LV_EVENT_STYLE_CHANGED, /**< Object's style has changed*/
LV_EVENT_LAYOUT_CHANGED, /**< The children position has changed due to a layout recalculation*/
LV_EVENT_GET_SELF_SIZE, /**< Get the internal size of a widget*/
_LV_EVENT_LAST, /** Number of default events*/
LV_EVENT_PREPROCESS = 0x80, /** This is a flag that can be set with an event so it's processed
before the class default event processing */
} lv_event_code_t;Enter the device event
/** Enter the device event */
LV_EVENT_PRESSED, /**< Object is pressed */
LV_EVENT_PRESSING, /**< Object is pressed ( Continuously call... When pressed ) */
LV_EVENT_PRESS_LOST, /**< The object is still pressed , But the cursor / Slide your fingers away from the object */
LV_EVENT_SHORT_CLICKED, /**< The object is pressed for a short period of time and then released , If you scroll, do not call */
LV_EVENT_LONG_PRESSED, /**< The object is at least pressed long_press_time( Specify in the input device driver ), If you scroll, do not call */
LV_EVENT_LONG_PRESSED_REPEAT, /**< At every long_press_repeat_time ms mslong_press_time Then call , If you scroll, do not call */
LV_EVENT_CLICKED, /**< If the object does not scroll , Then call ( Press ) */
LV_EVENT_RELEASED, /**< The object is released and called */
LV_EVENT_SCROLL_BEGIN, /**< Start rolling . The event parameter is NULL perhaps lv_anim_t *, You can modify */
LV_EVENT_SCROLL_END, /**< Roll over */
LV_EVENT_SCROLL, /**< rolling */
LV_EVENT_GESTURE, /**< Gesture detected . adopt lv_indev_get_gesture_dir(lv_indev_get_act()); obtain */
LV_EVENT_KEY, /**< KEY Sent to object . adopt lv_indev_get_key(lv_indev_get_act()); Get the secret key */
LV_EVENT_FOCUSED, /**< The object is focused */
LV_EVENT_DEFOCUSED, /**< Object unfocus */
LV_EVENT_LEAVE, /**< The object is unfocused but still selected */
LV_EVENT_HIT_TEST, /**< Perform advanced hit test ( Read the manual carefully ) */- LV_EVENT_PRESSED: Object is pressed
- LV_EVENT_PRESSING: Object is pressed ( Continuously call... When pressed )
- LV_EVENT_PRESS_LOST: The object is still pressed , But the cursor / Slide your fingers away from the object
- LV_EVENT_SHORT_CLICKED: The object is pressed for a short period of time and then released , If you scroll, do not call
- LV_EVENT_LONG_PRESSED: The object is at least pressed long_press_time( Specify in the input device driver ), If you scroll, do not call
- LV_EVENT_LONG_PRESSED_REPEAT: At every long_press_repeat_time ms mslong_press_time Then call , If you scroll, do not call
- LV_EVENT_CLICKED: If the object does not scroll , Then call ( Press )
- LV_EVENT_RELEASED: The object is released and called
- LV_EVENT_SCROLL_BEGIN: Start rolling . The event parameter is NULL perhaps lv_anim_t *, You can modify
- LV_EVENT_SCROLL_END: Roll over
- LV_EVENT_SCROLL: rolling
- LV_EVENT_GESTURE: Gesture detected .lv_indev_get_gesture_dir(lv_indev_get_act()); Get gestures
- LV_EVENT_KEY:KEY Sent to object . adopt lv_indev_get_key(lv_indev_get_act()); Get the secret key
- LV_EVENT_FOCUSED: The object is focused
- LV_EVENT_DEFOCUSED: Object unfocus
- LV_EVENT_LEAVE: The object is unfocused but still selected
- LV_EVENT_HIT_TEST: Perform advanced hit test ( Read the manual carefully )
Graphic Events
/** Graphic Events */
LV_EVENT_COVER_CHECK, /**< Check whether the object completely covers an area . The event parameter is lv_cover_check_info_t * .*/
LV_EVENT_REFR_EXT_DRAW_SIZE, /**< Get the additional drawing area needed around the object (e.g. shadow ). The event parameter used to store the size is lv_coord_t * .*/
LV_EVENT_DRAW_MAIN_BEGIN, /**< Start the main drawing stage */
LV_EVENT_DRAW_MAIN, /**< Execute main drawing */
LV_EVENT_DRAW_MAIN_END, /**< Complete the main drawing stage */
LV_EVENT_DRAW_POST_BEGIN, /**< Start the post drawing stage ( When all sub objects are drawn )*/
LV_EVENT_DRAW_POST, /**< Execute post plot ( When all sub objects are drawn )*/
LV_EVENT_DRAW_POST_END, /**< Finish the later drawing stage ( When all sub objects are drawn )*/
LV_EVENT_DRAW_PART_BEGIN, /**< Start part of the drawing . The event parameter is lv_obj_draw_dsc_t * . */
LV_EVENT_DRAW_PART_END, /**< Complete some drawings . The event parameter is lv_obj_draw_dsc_t * . */- LV_EVENT_COVER_CHECK: Check whether the object completely covers an area . The event parameter is lv_cover_check_info_t * .
- LV_EVENT_REFR_EXT_DRAW_SIZE: Get the additional drawing area needed around the object (e.g. shadow ). The event parameter used to store the size is lv_coord_t * .
- LV_EVENT_DRAW_MAIN_BEGIN: Start the main drawing stage
- LV_EVENT_DRAW_MAIN: Execute main drawing
- LV_EVENT_DRAW_MAIN_END: Complete the main drawing stage
- LV_EVENT_DRAW_POST_BEGIN: Start the post drawing stage ( When all sub objects are drawn )
- LV_EVENT_DRAW_POST: Execute post plot ( When all sub objects are drawn )
- LV_EVENT_DRAW_POST_END: Finish the later drawing stage ( When all sub objects are drawn )
- LV_EVENT_DRAW_PART_BEGIN: Start part of the drawing . The event parameter is lv_obj_draw_dsc_t * .
- LV_EVENT_DRAW_PART_END: Complete some drawings . The event parameter is lv_obj_draw_dsc_t * .
Other events
/** Other events */
LV_EVENT_DELETE, /**< Object is being deleted */
LV_EVENT_CHILD_CHANGED, /**< Child objects are being removed / add to , Location / The size is being changed */
LV_EVENT_CHILD_CREATED, /**< Child objects are created , Bubble for all parent objects */
LV_EVENT_CHILD_DELETED, /**< Sub objects are deleted , Bubble for all parent objects */
LV_EVENT_SCREEN_UNLOAD_START, /**< Screen uninstall starts , Calling lv_scr_load/lv_scr_load_anim Trigger immediately */
LV_EVENT_SCREEN_LOAD_START, /**< Screen loading starts , Triggered when the screen change delay expires */
LV_EVENT_SCREEN_LOADED, /**< Load screen , Called when all animations are complete */
LV_EVENT_SCREEN_UNLOADED, /**< Uninstall screen , Called when all animations are complete */
LV_EVENT_SIZE_CHANGED, /**< Coordinates of objects / The size is changed */
LV_EVENT_STYLE_CHANGED, /**< The object style is changed */
LV_EVENT_LAYOUT_CHANGED, /**< The position of the object calculated by the layout is changed */
LV_EVENT_GET_SELF_SIZE, /**< Get the internal size of the part */- LV_EVENT_DELETE: Object is being deleted
- LV_EVENT_CHILD_CHANGED: Child objects are being removed / add to , Location / The size is being changed
- LV_EVENT_CHILD_CREATED: Child objects are created , Bubble for all parent objects
- LV_EVENT_CHILD_DELETED: Sub objects are deleted , Bubble for all parent objects
- LV_EVENT_SCREEN_UNLOAD_START: Screen uninstall starts , Calling lv_scr_load/lv_scr_load_anim Trigger immediately
- LV_EVENT_SCREEN_LOAD_START: Screen loading starts , Triggered when the screen change delay expires
- LV_EVENT_SCREEN_LOADED: Load screen , Called when all animations are complete
- LV_EVENT_SCREEN_UNLOADED: Uninstall screen , Called when all animations are complete
- LV_EVENT_SIZE_CHANGED: Coordinates of objects / The size is changed
- LV_EVENT_STYLE_CHANGED: The object style is changed
- LV_EVENT_LAYOUT_CHANGED: The position of the object calculated by the layout is changed
- LV_EVENT_GET_SELF_SIZE: Get the internal size of the part
Special events
/** Special events*/
LV_EVENT_VALUE_CHANGED, /**< The value of the object is changed (i.e. Slider movement ) */
LV_EVENT_INSERT, /**< Text is inserted into the object . The data inserted by the event is char * .*/
LV_EVENT_REFRESH, /**< The notification object refreshes the display on it ( For the user ) */
LV_EVENT_READY, /**< A process has been completed */
LV_EVENT_CANCEL, /**< A process was canceled */- LV_EVENT_VALUE_CHANGED: The value of the object is changed (i.e. Slider movement )
- LV_EVENT_INSERT: Text is inserted into the object . The data inserted by the event is char * .
- LV_EVENT_REFRESH: The notification object refreshes the display on it ( For the user )
- LV_EVENT_READY: A process has been completed
- LV_EVENT_CANCEL: A process was canceled
LV_EVENT_REFRESH : Let the user use it to notify the object to refresh
Custom events
Any custom event code can be registered through the following function
uint32_t <EVENT_CODE> = lv_event_register_id();
/* example: */
uint32_t USER_Event_ONE = lv_event_register_id();Send events
Send events manually ( Include custom events ):
lv_event_send(obj, <EVENT_CODE> &some_data).Callback Arguments
lv_event_t Is the only parameter passed to the event callback ! Include all data .
typedef struct _lv_event_t {
struct _lv_obj_t * target;
struct _lv_obj_t * current_target;
lv_event_code_t code;
void * user_data;
void * param;
struct _lv_event_t * prev;
uint8_t deleted : 1;
uint8_t stop_processing : 1;
uint8_t stop_bubbling : 1;
} lv_event_t;
of lv_event_t Function of
/* Get event code */
lv_event_get_code(e)
/* Gets the object that sent the event */
lv_event_get_current_target(e)
/* Gets the object that originally triggered the event , Bubbling related */
lv_event_get_target(e)
/* Get the pointer passed as the last parameter */
lv_event_get_user_data(e)
/* Get the parameter passed as the last parameter */
lv_event_get_param(e)Event Bubbling
stay Object events and event bubbles The article makes a detailed introduction !
Subsequent projects will continue to be updated if they use other !!
边栏推荐
- DDoS protection with iptables
- 30天刷题训练(一)
- 记一次COOKIE的伪造登录
- R language uses LM function to build linear regression model and subset function to specify subset of data set to build regression model (use floor function and length function to select the former pa
- Implementation of StrCmp, strstr, memcpy, memmove
- On websocket
- 对“Image Denoising Using an Improved Generative Adversarial Network with Wasserstein Distance“的理解
- Master closures and consolidate basic skills
- Record a fake login of cookie
- Analyzing the principle of DNS resolution in kubernetes cluster
猜你喜欢

算法---不同路径(Kotlin)

Security assurance is based on software life cycle - networkpolicy application

Algorithm --- different paths (kotlin)

7.依赖注入

对“Image Denoising Using an Improved Generative Adversarial Network with Wasserstein Distance“的理解

The strongest distributed locking tool: redisson

MySQL开发技巧——视图

目标检测:速度和准确性比较(Fater R-CNN,R-FCN,SSD,FPN,RetinaNet和YOLOv3)

产品经理:岗位职责表

最强分布式锁工具:Redisson
随机推荐
Vite configuring path aliases in the project
R语言可视化散点图、使用ggrepel包的geom_text_repel函数避免数据点之间的标签互相重叠(使用参数xlim和ylim将标签添加到可视化图像的特定区域、指定标签线段并添加箭头)
word打字时后面的字会消失是什么原因?如何解决?
Lyscript get previous and next instructions
Thoroughly master binary search
POJ3268最短路径题解
DXF读写:标注样式组码中文说明
Graph traversal (BFS & DFS basis)
Poj1860 currency exchange solution
R language uses LM function to build multiple linear regression model, writes regression equation according to model coefficient, and uses conflict function to give 95% confidence interval of regressi
30 day question brushing plan (II)
对“Image Denoising Using an Improved Generative Adversarial Network with Wasserstein Distance“的理解
Implementation of StrCmp, strstr, memcpy, memmove
7.依赖注入
Socket类关于TCP字符流编程的理解学习
产品经理:岗位职责表
Remember to use pdfbox once to parse PDF and obtain the key data of PDF
Security assurance is based on software life cycle -istio authentication mechanism
SLAM论文合集
SQL daily practice (Niuke new question bank) - day 4: advanced operators