当前位置:网站首页>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
边栏推荐
- LVGL 8.2 List
- 深度学习7 Transformer系列实例分割Mask2Former
- Ultrasonic distance meter based on 51 single chip microcomputer
- 第十七章 进程内存
- Combined with case: the usage of the lowest API (processfunction) in Flink framework
- 【云原生】我怎么会和这个数据库杠上了?
- R language dplyr package summary_ If function calculates the mean and median of all numerical data columns in dataframe data, and summarizes all numerical variables based on conditions
- 一种架构来完成所有任务—Transformer架构正在以一己之力统一AI江湖
- Ml: introduction, principle, use method and detailed introduction of classic cases of snap value
- 商业智能BI财务分析,狭义的财务分析和广义的财务分析有何不同?
猜你喜欢
聊聊保证线程安全的 10 个小技巧
Red envelope activity design in e-commerce system
LVGL 8.2 text shadow
STM32F1与STM32CubeIDE编程实例-MAX7219驱动8位7段数码管(基于GPIO)
使用CLion编译OGLPG-9th-Edition源码
Detailed index of MySQL
迅为IMX6Q开发板QT系统移植tinyplay
An overview of 2D human posture estimation
Wt588f02b-8s (c006_03) single chip voice IC scheme enables smart doorbell design to reduce cost and increase efficiency
潘多拉 IOT 开发板学习(RT-Thread)—— 实验3 按键实验(学习笔记)
随机推荐
Talk about 10 tips to ensure thread safety
[MySQL from introduction to proficiency] [advanced chapter] (V) SQL statement execution process of MySQL
统计php程序运行时间及设置PHP最长运行时间
开发中常见问题总结
10. (map data) offline terrain data processing (for cesium)
R language uses the DOTPLOT function of epidisplay package to visualize the frequency of data points in different intervals in the form of point graph, and uses the by parameter to specify the groupin
Real time data warehouse
Excel quickly merges multiple rows of data
Detailed index of MySQL
Ml: introduction, principle, use method and detailed introduction of classic cases of snap value
ML之shap:基于boston波士顿房价回归预测数据集利用Shap值对LiR线性回归模型实现可解释性案例
R language uses dplyr package group_ The by function and the summarize function calculate the mean and standard deviation of the target variables based on the grouped variables
redis 日常笔记
Digi重启XBee-Pro S2C生产,有些差别需要注意
remount of the / superblock failed: Permission denied
数据湖(十三):Spark与Iceberg整合DDL操作
Data warehouse interview question preparation
Use of arouter
【算法leetcode】面试题 04.03. 特定深度节点链表(多语言实现)
Test process arrangement (3)