当前位置:网站首页>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
边栏推荐
- Node mongodb installation
- C language personal address book management system
- Leetcode t49: grouping of alphabetic words
- Transplant tinyplay for imx6q development board QT system
- Pandora IOT development board learning (RT thread) - Experiment 3 button experiment (learning notes)
- 数据埋点的一些问题和想法
- R language ggplot2 visualization: gganimate package creates animated graph (GIF) and uses anim_ The save function saves the GIF visual animation
- Xcode abnormal pictures cause IPA packet size problems
- An overview of 2D human posture estimation
- 失败率高达80%,企业数字化转型路上有哪些挑战?
猜你喜欢
No servers available for service: xxxx
Detailed explanation of visual studio debugging methods
WT588F02B-8S(C006_03)单芯片语音ic方案为智能门铃设计降本增效赋能
Codeforce:c. sum of substrings
An overview of 2D human posture estimation
Real time data warehouse
Pandora IOT development board learning (RT thread) - Experiment 3 button experiment (learning notes)
Leetcode T48:旋转图像
The implementation of OSD on rk1126 platform supports color translucency and multi-channel support for Chinese
leetcode:6110. The number of incremental paths in the grid graph [DFS + cache]
随机推荐
为什么国产手机用户换下一部手机时,都选择了iPhone?
LVGL 8.2 Line
【MySQL从入门到精通】【高级篇】(四)MySQL权限管理与控制
Opencv3.2 and opencv2.4 installation
MySQL stored procedure exercise
使用CLion编译OGLPG-9th-Edition源码
LVGL 8.2 Menu
数据埋点的一些问题和想法
Digi restarts XBee Pro S2C production. Some differences need to be noted
10. (map data) offline terrain data processing (for cesium)
Leetcode T47: 全排列II
leetcode:6109. 知道秘密的人数【dp的定义】
潘多拉 IOT 开发板学习(RT-Thread)—— 实验3 按键实验(学习笔记)
《opencv学习笔记》-- 线性滤波:方框滤波、均值滤波、高斯滤波
Programmer turns direction
商業智能BI財務分析,狹義的財務分析和廣義的財務分析有何不同?
AI and Life Sciences
Scratch Castle Adventure Electronic Society graphical programming scratch grade examination level 3 true questions and answers analysis June 2022
R language ggplot2 visualization: gganimate package creates dynamic line graph animation (GIF) and uses transition_ The reveal function displays data step by step along a given dimension in the animat
LVGL 8.2 List