当前位置:网站首页>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

边栏推荐
- 数据中台概念
- Leetcode t47: full arrangement II
- 深度学习7 Transformer系列实例分割Mask2Former
- MySQL triggers
- Codeforce:c. sum of substrings
- (1)性能调优的标准和做好调优的正确姿势-有性能问题,上HeapDump性能社区!
- (1) The standard of performance tuning and the correct posture for tuning - if you have performance problems, go to the heapdump performance community!
- Test process arrangement (2)
- Leetcode 61: rotating linked list
- First experience of ViewModel
猜你喜欢

C # WPF realizes the real-time screen capture function of screen capture box

flink sql-client.sh 使用教程

商业智能BI财务分析,狭义的财务分析和广义的财务分析有何不同?

Count the running time of PHP program and set the maximum running time of PHP

SqlServer函数,存储过程的创建和使用

数据湖(十三):Spark与Iceberg整合DDL操作

Node mongodb installation

Free, easy-to-use, powerful lightweight note taking software evaluation: drafts, apple memo, flomo, keep, flowus, agenda, sidenote, workflow

Intelligence d'affaires bi analyse financière, analyse financière au sens étroit et analyse financière au sens large sont - ils différents?

leetcode:6109. 知道秘密的人数【dp的定义】
随机推荐
No servers available for service: xxxx
Learn kernel 3: use GDB to track the kernel call chain
[information retrieval] experiment of classification and clustering
nowcoder重排链表
【信息检索】链接分析
商业智能BI财务分析,狭义的财务分析和广义的财务分析有何不同?
R language uses bwplot function in lattice package to visualize box plot and par Settings parameter custom theme mode
实战解惑 | OpenCV中如何提取不规则ROI区域
LVLG 8.2 circular scrolling animation of a label
Solutions to the problems of miui12.5 red rice k20pro using Au or povo2
LVGL 8.2 Draw label with gradient color
潘多拉 IOT 开发板学习(RT-Thread)—— 实验3 按键实验(学习笔记)
SqlServer函数,存储过程的创建和使用
【算法leetcode】面试题 04.03. 特定深度节点链表(多语言实现)
商業智能BI財務分析,狹義的財務分析和廣義的財務分析有何不同?
Wt588f02b-8s (c006_03) single chip voice IC scheme enables smart doorbell design to reduce cost and increase efficiency
10. (map data) offline terrain data processing (for cesium)
Compile oglpg-9th-edition source code with clion
The failure rate is as high as 80%. What are the challenges on the way of enterprise digital transformation?
深度学习7 Transformer系列实例分割Mask2Former