当前位置:网站首页>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); // 添加所有事件
}
运行效果

边栏推荐
- 【Rust日报】2021-01-22 首份Rust月刊杂志邀请大家一起参与
- ArcGIS Pro脚本工具(6)——修复CAD图层数据源
- Matplotlib notes: contour & Contour
- 技能梳理[email protected]在oled上控制一条狗的奔跑
- Q-Learning笔记
- Circuit breaker hystrixcircuitbreaker
- Ant s19xp appeared in 140t, why is it called the computing power ceiling by the world
- 苹果5G芯片被曝研发失败,QQ密码bug引热议,蔚来回应做空传闻,今日更多大新闻在此...
- 机器学习面试准备(一)KNN
- Koreano essential creates a professional style
猜你喜欢

matplotlib 笔记: contourf & contour

ArcGIS Pro + PS 矢量化用地规划图

sCrypt 中的 ECDSA 签名验证

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

CSDN博客运营团队2022年H1总结

RobotFramework学习笔记:环境安装以及robotframework-browser插件的安装

WGet -- 404 not found due to spaces in URL

CSDN blog operation team 2022 H1 summary

CVPR 2022 | Tsinghua & bytek & JD put forward BRT: Bridging Transformer for vision and point cloud 3D target detection

Q-Learning笔记
随机推荐
mysql数据库基础:TCL事务控制语言
scratch绘制正方形 电子学会图形化编程scratch等级考试二级真题和答案解析2022年6月
内存逃逸分析
59 websites programmers need to know
Mysql database foundation: views and variables
Yixian e-commerce released its first quarterly report: adhere to R & D and brand investment to achieve sustainable and high-quality development
"Kunming City coffee map" was opened again, and coffee brought the city closer
How to deploy deflationary combustion destruction contract code in BSC chain_ Deploy dividend and marketing wallet contract code
Circuit breaker hystrixcircuitbreaker
半钢同轴射频线的史密斯圆图查看和网络分析仪E5071C的射频线匹配校准
SGD has many improved forms. Why do most papers still use SGD?
Gd32 RT thread PWM drive function
Dyson design award, changing the world with sustainable design
Curl --- the request fails when the post request parameter is too long (more than 1024b)
[rust weekly database] num bigint - large integer
移植完整版RT-Thread到GD32F4XX(详细)
Foster design method
Es common curl finishing
再测云原生数据库性能:PolarDB依旧最强,TDSQL-C、GaussDB变化不大
R语言aov函数进行重复测量方差分析(Repeated measures ANOVA、其中一个组内因素和一个组间因素)、分别使用interaction.plot函数和boxplot对交互作用进行可视化