[Menu widgets]
Object Functions
FileBrowser Object.

FileBrowser is a component used to select files.
Through the API, you can set the disk, and it will display and read the selected file path for subsequent processing by the user.
Note:
- FileBrowser only supports English file names
- The maximum length of the path is 1024 characters.
- Display up to 128 files/folders.
FileBrowser Properties.

Identifier:
- ID: Unique number that identifies the object.
- Name: User-definable name for the object. It can be used with 86HMI API.
Geometry:
- X: Object X coordinate.
- Y: Object Y coordinate.
- Width: Object width.
- Height: Object height.
Options:
- Spacing: The line spacing between each option is:
- Smallest
- Smaller
- Normal
- Larger

- TextFont: Choose from 6 default font styles. For font configuration instructions, please refer to Theme Management.
- ObjColor: Choose from 4 themed colors. For font configuration instructions, please refer to Theme Management.
- Enable: Select the default state of the object, enable or disable.
- Order: Object order. It can adjust the object order by up/down, which can be viewed on the Object List.
API Functions
setFileBrowserFilter()
Description
Set a filter of FileBrowser object.
Here are the rules:
- ? matches exactly one occurrence of any character.
- * matches any occurrence of any character (including zero occurrences).
Examples:
- *.txt will match any filename ending with .txt.
- ???.txt will match any file with exactly three characters in the filename ending with .txt.
Matching wildcards:

Syntax
void setFileBrowserFilter(lv_obj_t* id, char* filter, int filterIndex);
void setFileBrowserFilter(char* name, char* filter, int filterIndex);
void setFileBrowserFilter(lv_obj_t* id, char* filter);
void setFileBrowserFilter(char* name, char* filter);
Parameters
[in] id
Object ID.[in] name
Object Name.[in] char* filter
The filter content.[in] int filterIndex
The filter index.
Return
None.
Example
#include "myhmi.h"
void setup() {
Hmi.begin();
// ...
Hmi.setFileBrowserFilter(p1fb1, "a");
}
void loop() {
// ...
}deleteFileBrowserFilter()
Description
Delete the filter of FileBrowser object.
Syntax
void deleteFileBrowserFilter(lv_obj_t* id, int filterIndex);
void deleteFileBrowserFilter(char* name, int filterIndex);
void deleteFileBrowserFilter(lv_obj_t* id);
void deleteFileBrowserFilter(char* name);
Parameters
[in] id
Object ID.[in] name
Object Name.[in] int filterIndex
The filter index.
Return
None.
Example
#include "myhmi.h"
void setup() {
Hmi.begin();
// ...
Hmi.setFileBrowserFilter(p1fb1, "a");
delay(1000);
Hmi.deleteFileBrowserFilter(p1fb1);
}
void loop() {
// ...
}setFileBrowserDisk()
Description
Select the disk of FileBrowser object.
Syntax
void setFileBrowserDisk(lv_obj_t* id, int disk);
void setFileBrowserDisk(char* name, int disk);
Parameters
[in] id
Object ID.[in] name
Object Name.[in] int disk
Select the disk.
Return
None.
Example
#include "myhmi.h"
void setup() {
Hmi.begin();
// ...
Hmi.setFileBrowserDisk(p1fb1, USBDISK);
}
void loop() {
// HMI event
BEGIN_HMI_EVENT_PROC
{
// USB
if (Hmi.buttonClicked(p1b1))
{
Hmi.importToTextList(p1tl1, Hmi.getFileBrowserFilePath(p1fb1), USBDISK);
}
if (Hmi.buttonClicked(p1b2))
{
Hmi.clearTextList(p1tl1);
}
}
END_HMI_EVENT_PROC
delay(100);
}getFileBrowserFolder()
Description
Get the folder of FileBrowser object.
Syntax
char* getFileBrowserFolder(lv_obj_t* id);
char* getFileBrowserFolder(char* name);
Parameters
[in] id
Object ID.[in] name
Object Name.
Return
The folder of FileBrowser object.
Example
#include "myhmi.h"
void setup() {
Serial.begin(115200);
while (!Serial);
Hmi.begin();
// ...
Serial.println(Hmi.getFileBrowserFolder(p1fb1));
}
void loop() {
// ...
}getFileBrowserFilePath()
Description
Get the file path of FileBrowser object.
Syntax
char* getFileBrowserFilePath(lv_obj_t* id);
char* getFileBrowserFilePath(char* name);
Parameters
[in] id
Object ID.[in] name
Object Name.
Return
The file path of FileBrowser object.
Example
#include "myhmi.h"
void setup() {
Hmi.begin();
// ...
Hmi.setFileBrowserDisk(p1fb1, USBDISK);
}
void loop() {
// HMI event
BEGIN_HMI_EVENT_PROC
{
// USB
if (Hmi.buttonClicked(p1b1))
{
Hmi.importToTextList(p1tl1, Hmi.getFileBrowserFilePath(p1fb1), USBDISK);
}
if (Hmi.buttonClicked(p1b2))
{
Hmi.clearTextList(p1tl1);
}
}
END_HMI_EVENT_PROC
delay(100);
}Please see the 86HMI Editor User Manual for more instructions on 86HMI widgets and API usage.