当前位置:网站首页>LVGL 8.2 List
LVGL 8.2 List
2022-07-04 14:35:00 【Fairy sword love】
Event callback handler
static lv_obj_t* list1;
static void event_handler(lv_event_t* e)
{
lv_event_code_t code = lv_event_get_code(e); // Get the event code generated by the object
lv_obj_t* obj = lv_event_get_target(e); // Get the object that generated the event
if (code == LV_EVENT_CLICKED) {
// LV_EVENT_CLICKED Event handling
LV_LOG_USER("Clicked: %s", lv_list_get_btn_text(list1, obj)); // Print list The text content corresponding to the click
}
}
establish List
static void lv_example_list_1(void)
{
/*Create a list*/
list1 = lv_list_create(lv_scr_act()); // establish List The control object
lv_obj_set_size(list1, 180, 220); // Set size
lv_obj_center(list1); // centered
/*Add buttons to the list*/
lv_obj_t* btn;
lv_list_add_text(list1, "File"); // add to File Text content
btn = lv_list_add_btn(list1, LV_SYMBOL_FILE, "New"); // Add keys
lv_obj_add_event_cb(btn, event_handler, LV_EVENT_CLICKED, NULL);// register LV_EVENT_CLICKED event
btn = lv_list_add_btn(list1, LV_SYMBOL_DIRECTORY, "Open");// Add keys
lv_obj_add_event_cb(btn, event_handler, LV_EVENT_CLICKED, NULL);// register LV_EVENT_CLICKED event
btn = lv_list_add_btn(list1, LV_SYMBOL_SAVE, "Save");// Add keys
lv_obj_add_event_cb(btn, event_handler, LV_EVENT_CLICKED, NULL);// register LV_EVENT_CLICKED event
btn = lv_list_add_btn(list1, LV_SYMBOL_CLOSE, "Delete");// Add keys
lv_obj_add_event_cb(btn, event_handler, LV_EVENT_CLICKED, NULL);// register LV_EVENT_CLICKED event
btn = lv_list_add_btn(list1, LV_SYMBOL_EDIT, "Edit");// Add keys
lv_obj_add_event_cb(btn, event_handler, LV_EVENT_CLICKED, NULL);// register LV_EVENT_CLICKED event
lv_list_add_text(list1, "Connectivity");// Add text content
btn = lv_list_add_btn(list1, LV_SYMBOL_BLUETOOTH, "Bluetooth");// Add keys
lv_obj_add_event_cb(btn, event_handler, LV_EVENT_CLICKED, NULL);// register LV_EVENT_CLICKED event
btn = lv_list_add_btn(list1, LV_SYMBOL_GPS, "Navigation");// Add keys
lv_obj_add_event_cb(btn, event_handler, LV_EVENT_CLICKED, NULL);// register LV_EVENT_CLICKED event
btn = lv_list_add_btn(list1, LV_SYMBOL_USB, "USB");// Add keys New
lv_obj_add_event_cb(btn, event_handler, LV_EVENT_CLICKED, NULL);// register LV_EVENT_CLICKED event
btn = lv_list_add_btn(list1, LV_SYMBOL_BATTERY_FULL, "Battery");// Add keys
lv_obj_add_event_cb(btn, event_handler, LV_EVENT_CLICKED, NULL);// register LV_EVENT_CLICKED event
lv_list_add_text(list1, "Exit");// Add text content
btn = lv_list_add_btn(list1, LV_SYMBOL_OK, "Apply");// Add keys
lv_obj_add_event_cb(btn, event_handler, LV_EVENT_CLICKED, NULL);// register LV_EVENT_CLICKED event
btn = lv_list_add_btn(list1, LV_SYMBOL_CLOSE, "Close");// Add keys
lv_obj_add_event_cb(btn, event_handler, LV_EVENT_CLICKED, NULL);// register LV_EVENT_CLICKED event
}
Running effect
边栏推荐
- flink sql-client. SH tutorial
- Talk about 10 tips to ensure thread safety
- MySQL的触发器
- Codeforce:c. sum of substrings
- R language uses the mutation function of dplyr package to standardize the specified data column (using mean function and SD function), and calculates the grouping mean of the standardized target varia
- 【算法leetcode】面试题 04.03. 特定深度节点链表(多语言实现)
- redis 日常笔记
- 潘多拉 IOT 开发板学习(RT-Thread)—— 实验3 按键实验(学习笔记)
- scratch古堡历险记 电子学会图形化编程scratch等级考试三级真题和答案解析2022年6月
- Test process arrangement (2)
猜你喜欢
商業智能BI財務分析,狹義的財務分析和廣義的財務分析有何不同?
The implementation of OSD on rk1126 platform supports color translucency and multi-channel support for Chinese
Digi XBee 3 rf: 4 protocols, 3 packages, 10 major functions
Data Lake (13): spark and iceberg integrate DDL operations
数据中台概念
数据湖(十三):Spark与Iceberg整合DDL操作
Leetcode T48:旋转图像
Digi重启XBee-Pro S2C生产,有些差别需要注意
92. (cesium chapter) cesium building layering
Classify boost libraries by function
随机推荐
炒股网上开户安全吗?会不会被骗。
The failure rate is as high as 80%. What are the challenges on the way of enterprise digital transformation?
R language uses the mutation function of dplyr package to standardize the specified data column (using mean function and SD function), and calculates the grouping mean of the standardized target varia
为什么国产手机用户换下一部手机时,都选择了iPhone?
Abnormal value detection using shap value
基于51单片机的超声波测距仪
开发中常见问题总结
STM32F1与STM32CubeIDE编程实例-MAX7219驱动8位7段数码管(基于GPIO)
LVLG 8.2 circular scrolling animation of a label
[MySQL from introduction to proficiency] [advanced chapter] (V) SQL statement execution process of MySQL
MySQL的触发器
C language small commodity management system
R language ggplot2 visualization: gganimate package creates animated graph (GIF) and uses anim_ The save function saves the GIF visual animation
数据埋点的一些问题和想法
Map of mL: Based on Boston house price regression prediction data set, an interpretable case of xgboost model using map value
Count the running time of PHP program and set the maximum running time of PHP
【MySQL从入门到精通】【高级篇】(四)MySQL权限管理与控制
Chapter 17 process memory
Sqlserver functions, creation and use of stored procedures
一种架构来完成所有任务—Transformer架构正在以一己之力统一AI江湖