当前位置:网站首页>LVGL 8.2 Simple Drop down list
LVGL 8.2 Simple Drop down list
2022-06-30 10:08:00 【仙剑情缘】
事件处理回调函数
static void event_handler(lv_event_t* e)
{
lv_event_code_t code = lv_event_get_code(e); // 获取对象产生的事件码
lv_obj_t* obj = lv_event_get_target(e); // 获取产生事件的对象
if (code == LV_EVENT_VALUE_CHANGED) {
// 处理值已改变事件
char buf[32];
lv_dropdown_get_selected_str(obj, buf, sizeof(buf)); // 获取选中对象的文本内容
LV_LOG_USER("Option: %s", buf); // 打印文本内容
}
}
创建dropdown
static void lv_example_dropdown_1(void)
{
/*Create a normal drop down list*/
lv_obj_t* dd = lv_dropdown_create(lv_scr_act()); //创建dropdown对象
lv_dropdown_set_options(dd, "Apple\n"
"Banana\n"
"Orange\n"
"Cherry\n"
"Grape\n"
"Raspberry\n"
"Melon\n"
"Orange\n"
"Lemon\n"
"Nuts"); // 设置下拉列表选项内容
lv_obj_align(dd, LV_ALIGN_TOP_MID, 0, 20); //LV_ALIGN_TOP_MID方式对齐
lv_obj_add_event_cb(dd, event_handler, LV_EVENT_ALL, NULL); // 添加所有事件
}
运行效果
边栏推荐
- Use keil5 software to simulate and debug gd32f305 from 0
- GD32 RT-Thread flash驱动函数
- 【深度学习】深度学习检测小目标常用方法
- Gd32 RT thread ota/bootloader driver function
- Matplotlib notes: contour & Contour
- GeoffreyHinton:我的五十年深度学习生涯与研究心法
- [rust daily] several new libraries were released on January 23, 2021
- Leetcode question brushing (III) -- binary search (go Implementation)
- 历史上的今天:微软收购 PowerPoint 开发商;SGI 和 MIPS 合并
- Ant s19xp appeared in 140t, why is it called the computing power ceiling by the world
猜你喜欢
WGet -- 404 not found due to spaces in URL
Matplotlib notes: contour & Contour
[email protected]在oled上控制一条狗的奔跑"/>
技能梳理[email protected]在oled上控制一条狗的奔跑
Apple's 5g chip was revealed to have failed in research and development, and the QQ password bug caused heated discussion. Wei Lai responded to the short selling rumors. Today, more big news is here
pytorch 笔记 torch.nn.BatchNorm1d
Remember the experience of an internship. It is necessary to go to the pit (I)
[email protected]+阿里云+nbiot+dht11+bh1750+土壤湿度传感器+oled"/>
技能梳理[email protected]+阿里云+nbiot+dht11+bh1750+土壤湿度传感器+oled
Auto SEG loss: automatic loss function design
CSDN blog operation team 2022 H1 summary
Getting started with X86 - take over bare metal control
随机推荐
技能梳理[email protected]+阿里云+nbiot+dht11+bh1750+土壤湿度传感器+oled
matplotlib 笔记: contourf & contour
我的远程办公深度体验 | 社区征文
Leetcode question brushing (IV) -- greedy thought (go Implementation)
Ionic4 drag the ion reorder group component to change the item order
GD32 RT-Thread PWM驱动函数
R language plot visualization: use plot to visualize the prediction confidence of the multi classification model, the prediction confidence of each data point of the model in the 2D grid, and the conf
Mysql database foundation: TCL transaction control language
go-zero微服务实战系列(八、如何处理每秒上万次的下单请求)
WGet -- 404 not found due to spaces in URL
Notes on numerical calculation - iterative solution of linear equations
马斯克推特粉丝过亿了,但他在线失联已一周
[rust daily] several new libraries were released on January 23, 2021
GD32 RT-Thread OTA/Bootloader驱动函数
Voir le changement technologique à travers la Légion Huawei (5): Smart Park
数学知识复习:第二型曲线积分
Pytorch Notebook. Nn. Batchnorm1d
Gd32 RT thread DAC driver function
今晚19:00知识赋能第2期直播丨OpenHarmony智能家居项目之控制面板界面设计
吴恩达2022机器学习专项课测评来了!