当前位置:网站首页>LVGL 8.2 Simple Drop down list
LVGL 8.2 Simple Drop down list
2022-06-30 10:53:00 【Fairy sword love】
Event handling callback function
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_VALUE_CHANGED) {
// Process value changed event
char buf[32];
lv_dropdown_get_selected_str(obj, buf, sizeof(buf)); // Get the text content of the selected object
LV_LOG_USER("Option: %s", buf); // Print text content
}
}
establish dropdown
static void lv_example_dropdown_1(void)
{
/*Create a normal drop down list*/
lv_obj_t* dd = lv_dropdown_create(lv_scr_act()); // establish dropdown object
lv_dropdown_set_options(dd, "Apple\n"
"Banana\n"
"Orange\n"
"Cherry\n"
"Grape\n"
"Raspberry\n"
"Melon\n"
"Orange\n"
"Lemon\n"
"Nuts"); // Set drop-down list option content
lv_obj_align(dd, LV_ALIGN_TOP_MID, 0, 20); //LV_ALIGN_TOP_MID Alignment
lv_obj_add_event_cb(dd, event_handler, LV_EVENT_ALL, NULL); // Add all events
}
Running effect
边栏推荐
- LVGL 8.2 Image styling and offset
- Auto Seg-Loss: 自动损失函数设计
- Mysql database foundation: views and variables
- File sharing server
- 苹果高管公然“开怼”:三星抄袭 iPhone,只加了个大屏
- sCrypt 中的 ECDSA 签名验证
- CSDN daily one practice 2021.11.06 question 1 (C language)
- Machine learning interview preparation (I) KNN
- Double-DQN笔记
- LVGL 8.2 Simple Image button
猜你喜欢
智能DNA分子纳米机器人模型来了
Review of mathematical knowledge: curve integral of the second type
Pytorch notes torch nn. BatchNorm1d
The programmer was beaten.
The intelligent DNA molecular nano robot model is coming
小程序中读取腾讯文档的表格数据
Qt之实现动效导航栏
数学知识复习:第二型曲线积分
软件测试工程师面试基础题(应届生和测试小菜必备)最基础的面试题
Deep dive kotlin synergy (16): Channel
随机推荐
MySQL从入门到精通50讲(三十二)-ScyllaDB生产环境集群搭建
Criu enables hot migration
[rust daily] several new libraries were released on January 23, 2021
scratch绘制正方形 电子学会图形化编程scratch等级考试二级真题和答案解析2022年6月
滴滴开源敏捷测试用例管理平台!
June training (day 30) - topology sorting
深潜Kotlin协程(十六):Channel
[STL source code analysis] container (to be supplemented)
Collectors.toMap应用
SGD有多种改进的形式,为什么大多数论文中仍然用SGD?
智能DNA分子纳米机器人模型来了
& and - > priority
在 sCrypt 中实现高效的椭圆曲线点加法和乘法
ArrayList与顺序表
Voir le changement technologique à travers la Légion Huawei (5): Smart Park
Anhui "requirements for design depth of Hefei fabricated building construction drawing review" was printed and distributed; Hebei Hengshui city adjusts the pre-sale license standard for prefabricated
基于HAL库的按键(KEY)库函数
焕发青春的戴尔和苹果夹击,两大老牌PC企业极速衰败
ArcGIS Pro scripting tool (5) - delete duplicates after sorting
LeetCode Algorithm 86. 分隔链表