1 Star 0 Fork 0

panlin/LVGL文件浏览器_多文件选择器-自定义控件

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
example.c 1.51 KB
一键复制 编辑 原始数据 按行查看 历史
panlin 提交于 2023-10-14 00:46 . 初始上传代码
#include "lvgl/lvgl.h"
#include "m_lv_file_select.h"
static void event(lv_event_t *e)
{
lv_obj_t *obj = lv_event_get_target(e);
if(lv_event_get_code(e) == LV_EVENT_VALUE_CHANGED)
{
printf("OpenDir:%s\n",m_lv_file_select_get_dir(obj));
//m_lv_file_select_set_srot_flag(obj,false); /*call this interface to set the sort*/
//m_lv_file_select_set_srot(obj,fn); /*call this interface to customize the sort comparison function*/
}else if (lv_event_get_code(e) == LV_EVENT_READY)
{
printf("\nSelected:%s\n",m_lv_file_select_read(obj));
}
}
void example(void)
{
lv_obj_t *file_view = m_lv_file_select_create(lv_scr_act());
m_lv_file_select_open(file_view,"/",FILE_SELECT_MODE_ALL|FILE_SELECT_MODE_MULTI,NULL); /*select multiple files*/
// m_lv_file_select_open(file_view,"/",FILE_SELECT_MODE_DIR|FILE_SELECT_MODE_MULTI,NULL); /*select multiple files directory*/
// m_lv_file_select_open(file_view,"/",FILE_SELECT_MODE_DIR|FILE_SELECT_MODE_ONE,NULL); /*Select only one file*/
// m_lv_file_select_open(file_view,"/",FILE_SELECT_MODE_ALL|FILE_SELECT_MODE_ONE,NULL); /*Select only one directory*/
//m_lv_file_select_open(file_view,"/",FILE_SELECT_MODE_ALL|FILE_SELECT_MODE_MULTI,".jpg .bmp .png"); /*filter files and select multiple*/
//m_lv_file_select_open(file_view,"/",FILE_SELECT_MODE_ALL,NULL); /*file browser mode*/
lv_obj_add_event_cb(file_view,event,LV_EVENT_VALUE_CHANGED,NULL);
lv_obj_add_event_cb(file_view,event,LV_EVENT_READY,NULL);
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/panlin_code/lvgl_file_select.git
git@gitee.com:panlin_code/lvgl_file_select.git
panlin_code
lvgl_file_select
LVGL文件浏览器_多文件选择器-自定义控件
master

搜索帮助