当前位置:网站首页>LVGL 8.2 menu from a drop-down list
LVGL 8.2 menu from a drop-down list
2022-06-30 10:54:00 【Fairy sword love】
Event handling callback function
static void event_cb(lv_event_t* e)
{
lv_obj_t* dropdown = lv_event_get_target(e); // Get the object that generated the event
char buf[64];
lv_dropdown_get_selected_str(dropdown, buf, sizeof(buf)); // obtain dropdown Object selection
LV_LOG_USER("'%s' is selected", buf); // Print selection
}
Create a menu from a drop-down list
/** * Create a menu from a drop-down list and show some drop-down list features and styling */
static void lv_example_dropdown_3(void)
{
/*Create a drop down list*/
lv_obj_t* dropdown = lv_dropdown_create(lv_scr_act()); // establish dropdown object
lv_obj_align(dropdown, LV_ALIGN_TOP_LEFT, 10, 10); //LV_ALIGN_TOP_LEFT Alignment
lv_dropdown_set_options(dropdown, "New project\n"
"New file\n"
"Save\n"
"Save as ...\n"
"Open project\n"
"Recent projects\n"
"Preferences\n"
"Exit"); // Set the option content
/*Set a fixed text to display on the button of the drop-down list*/
lv_dropdown_set_text(dropdown, "Menu"); // Set fixed text Menu
/*Use a custom image as down icon and flip it when the list is opened*/
LV_IMG_DECLARE(img_caret_down) //img_caret_down Picture resource statement
lv_dropdown_set_symbol(dropdown, &img_caret_down); // Set up dropdown Symbol
lv_obj_set_style_transform_angle(dropdown, 1800, LV_PART_INDICATOR | LV_STATE_CHECKED); // LV_PART_INDICATOR and LV_STATE_CHECKED Property to rotate the picture 180 degree
/*In a menu we don't need to show the last clicked item*/
lv_dropdown_set_selected_highlight(dropdown, false); // Check to turn off highlighting
lv_obj_add_event_cb(dropdown, event_cb, LV_EVENT_VALUE_CHANGED, NULL);//dropdown add to LV_EVENT_VALUE_CHANGED Picture piece
}
Running effect
lv_dropdown_set_selected_highlight Function to open the selected item to highlight
lv_dropdown_set_selected_highlight(dropdown, true); // set true Turn on the highlight
Running effect
边栏推荐
- Pytorch Notebook. Nn. Batchnorm1d
- [deep learning] common methods for deep learning to detect small targets
- Viewing technological changes through Huawei Corps (V): smart Park
- 05_ Node JS file management module FS
- Double-DQN笔记
- 05_Node js 文件管理模块 fs
- Pycharm项目使用pyinstalle打包过程中问题及解决方案
- LeetCode Algorithm 86. 分隔链表
- MySQL导出sql脚本文件
- Use keil5 software to simulate and debug gd32f305 from 0
猜你喜欢
Overview of currency
Unity Shader - 踩坑 - BRP 管线中的 depth texture 的精度问题(暂无解决方案,推荐换 URP)
go-zero微服务实战系列(八、如何处理每秒上万次的下单请求)
The intelligent DNA molecular nano robot model is coming
中国将强制统一充电接口,苹果如不低头,iPhone将被踢出中国市场
腾讯云数据库工程师能力认证重磅推出,各界共话人才培养难题
Cp2112 teaching example of using USB to IIC communication
Mysql database foundation: constraint and identification columns
吴恩达2022机器学习专项课测评来了!
MySQL export SQL script file
随机推荐
苹果高管公然“开怼”:三星抄袭 iPhone,只加了个大屏
20万奖金池!【阿里安全 × ICDM 2022】大规模电商图上的风险商品检测赛火热报名中!...
电化学氧气传感器寿命、工作原理及应用介绍
DQN笔记
LVGL 8.2 menu from a drop-down list
How can the sports app keep the end-to-side background alive to make the sports record more complete?
【深度学习】深度学习检测小目标常用方法
[proteus simulation] Arduino uno led simulated traffic light
Pytorch notes: validation, model eval V.S torch. no_ grad
Auto Seg-Loss: 自动损失函数设计
LVGL 8.2 Image
MATLAB image histogram equalization, namely spatial filtering
Skill combing [email protected] control a dog's running on OLED
Circuit breaker hystrixcircuitbreaker
7 大轻量易用的工具,给开发者减压提效,助力企业敏捷上云 | Techo Day 精彩回顾...
ionic4 ion-reorder-group组件拖拽改变item顺序
LVGL8.2 Simple Checkboxes
再测云原生数据库性能:PolarDB依旧最强,TDSQL-C、GaussDB变化不大
go-zero微服务实战系列(八、如何处理每秒上万次的下单请求)
Machine learning interview preparation (I) KNN