Skip to content

lvgl.file

lvgl.file([parent, ]params)

Display a button showing a filename. Tapping it opens a popup file picker, using EdgeTX styling.

Parameters

NameReqTypeDescription
parentnoobjectoptional LVGL object to attach the new object to; if omitted the object is created in the top-level script window
paramsyestable
FieldTypeDescription
xnumberposition relative to the top-left of the parent
ynumberposition relative to the top-left of the parent
wnumberwidth
hnumberheight
colorcolor or functionprimary color for the object
posfunctiondynamic position callback returning x, y
sizefunctiondynamic size callback returning w, h
visiblefunctiondynamic visibility callback
floatingbooleankeep the object fixed inside a scrollable container, added in 2.11.6, defaults to false
titlestringtext displayed in the popup's header, defaults to an empty string
getfunctioncalled when the popup is opened, and after the selection changes, to get the currently selected filename; must return a string, defaults to nil
setfunctioncalled when the user picks a file; passed the selected filename (without path), defaults to nil
activefunctionsets the enabled/disabled state; must return a boolean, true to enable, defaults to nil
folderstringSD card folder to browse for files, defaults to nil
extensionstringextension filter, e.g. .png or concatenated .png.bmp to match multiple, defaults to nil (no filter)
hideExtensionbooleanif true, the extension is stripped before set is called and hidden in the picker list, defaults to false
maxLennumbermaximum filename length (measured after hideExtension stripping, if set); files with longer names are not shown in the picker list, defaults to 255

Returns

Name Type Description
- table LVGL object, or nil if not running as a One-Time script or fullscreen widget

Availability

  • Since: 2.11.0
  • Radio support: color-lcd

Notes

  • Only available for One-Time scripts and widgets running in full screen mode -- returns nil otherwise. @notice The popup closes and set is called when the user picks a file. @notice If the user taps outside the popup or presses RTN, the popup closes without calling set.

Source

radio/src/lua/api_colorlcd_lvgl.cpp