Skip to content

lvgl.menu

Syntax

lvgl.menu({settings})

Parameters

See the API page for parameter description and common settings.

Choice specific settings:

NameTypeDescriptionDefault if not set
titleStringText to be displayed in the header of the popup menu.Empty string
valuesTableMust contain a simple table of strings. Each string defines an options shown in the popup menu.Empty list
getFunctionCalled to get the index of the currently selected option, when the popup menu is first opened.
Must return a number between 1 and the number of values.
nil
setFunctionCalled when the user taps on a menu item.
The function is passed a single parameter wihich is the index of the selected item (1 .. number of values)
nil

Example

    lvgl.button({text="Menu", x=10, y=10,
      press=function() 
        lvgl.menu({title="Menu",
          values={"Option 1","Option 2","Option 3","Option 4","Option 5","Option 6","Option 7","Option 8","Option 9","Option 10",},
          set=function(n)
              -- 'Do something with the selected value'
          end
        })
      end
    })

Return values

N/A

Notes

The popup menu is closed when the user selects an item, and the 'set' function is called.

If the user taps outside the menu or the RTN key is pressed, the popup menu is closed and the 'set' function is not called.

API Status

AvailStatusComment
BW radiosfalse
Color radiostrueactiveOnly available for One-Time scripts and widgets running in full screen mode.

Change log

EdgeTX versionChange
2.11.1Introduced