当前位置:网站首页>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
边栏推荐
- Turn to cartoon learning notes
- Criu enables hot migration
- Foresniffer tutorial: extracting data
- JS FAQs
- Matplotlib notes: contour & Contour
- Skill combing [email protected] control a dog's running on OLED
- 软件测试工程师面试基础题(应届生和测试小菜必备)最基础的面试题
- Pandora IOT development board learning (HAL Library) - Experiment 1 running lantern (RGB) experiment (learning notes)
- 敏捷开发: 超级易用水桶估计系统
- CP2112使用USB转IIC通信教学示例
猜你喜欢
随机推荐
LVGL 8.2 Image
Cp2112 teaching example of using USB to IIC communication
Ionic4 drag the ion reorder group component to change the item order
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
如何解决跨域
第一届中国数字藏品大会即将召开
Auto Seg-Loss: 自动损失函数设计
Time complexity and space complexity
LVGL 8.2图片缩放及旋转
About Library (function library), dynamic library and static library
文件共享服务器
数据库什么时候需要使用索引【杭州多测师】【杭州多测师_王sir】
LVGL 8.2 Simple Drop down list
ionic4 ion-reorder-group组件拖拽改变item顺序
nvm、nrm、npx使用(安装、基本命令、参数、curl、wget)
Rejuvenated Dell and apple hit each other, and the two old PC enterprises declined rapidly
[机缘参悟-34]:光锥之内皆命运
Mysql database foundation: TCL transaction control language
透过华为军团看科技之变(五):智慧园区
运动App如何实现端侧后台保活,让运动记录更完整?