当前位置:网站首页>[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 !!
边栏推荐
- After finishing, help autumn move, I wish you call it an offer harvester
- 修订版 | 目标检测:速度和准确性比较(Faster R-CNN,R-FCN,SSD,FPN,RetinaNet和YOLOv3)...
- regular expression
- R language uses dpois function to generate Poisson distribution density data and plot function to visualize Poisson distribution density data
- 多线程与高并发(三)—— 源码解析 AQS 原理
- Machine learning (Zhou Zhihua) Chapter 6 notes on Support Vector Learning
- 盘点操作URL中常用的几个高效API
- Tutorial on the principle and application of database system (058) -- MySQL exercise (2): single choice question
- R语言ggplot2可视化:使用ggpubr包的ggviolin函数可视化小提琴图、设置palette参数自定义不同水平小提琴图的边框颜色
- 作为一个程序员,如何高效的管理时间?
猜你喜欢

Understanding of "image denoising using an improved generic advantageous network with Wasserstein distance"

How to play a data mining game entry Edition

Security assurance is based on software life cycle -psp application

Deploy application delivery services in kubernetes (Part 1)

30天刷题计划(二)

SQL daily practice (Niuke new question bank) - day 4: advanced operators

什么是自旋锁 自旋锁是指当一个线程尝试获取某个锁时,如果该锁已被其他线程占用,就一直循环检测锁是否被释放,而不是进入线程挂起或睡眠状态。 /** * 为什么用自旋锁:多个线程对同一个变量

word打字时后面的字会消失是什么原因?如何解决?

修订版 | 目标检测:速度和准确性比较(Faster R-CNN,R-FCN,SSD,FPN,RetinaNet和YOLOv3)...

DXF reading and writing: align the calculation of the position of the dimension text in the middle and above
随机推荐
a标签_文件下载(download属性)
Product Manager: job responsibility table
IP黑白名单
POJ3259虫洞题解
Remember to use pdfbox once to parse PDF and obtain the key data of PDF
【飞控开发基础教程7】疯壳·开源编队无人机-SPI(气压计数据获取)
Deploy application delivery services in kubernetes (Part 1)
在centos中安装mysql5.7.36
Security assurance is based on software life cycle - networkpolicy application
Multithreading and high concurrency (III) -- source code analysis AQS principle
R language uses dpois function to generate Poisson distribution density data and plot function to visualize Poisson distribution density data
On websocket
对“Image Denoising Using an Improved Generative Adversarial Network with Wasserstein Distance“的理解
redis哨兵机制
DXF读写:对齐尺寸标注文字居中、上方的位置计算
111. The sap ui5 fileuploader control realizes local file upload and encounters a cross domain access error when receiving the response from the server
DXF读写:标注样式组码中文说明
Qt5 development from introduction to mastery -- the first overview
Duplicate data in leetcode (442) array
Understanding of "image denoising using an improved generic advantageous network with Wasserstein distance"