lvgl.menu¶
Syntax¶
lvgl.menu({settings})
Parameters¶
See the API page for parameter description and common settings.
Choice specific settings:
| Name | Type | Description | Default if not set |
|---|---|---|---|
| title | String | Text to be displayed in the header of the popup menu. | Empty string |
| values | Table | Must contain a simple table of strings. Each string defines an options shown in the popup menu. | Empty list |
| get | Function | Called 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 |
| set | Function | Called 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¶
| Avail | Status | Comment | |
|---|---|---|---|
| BW radios | false | ||
| Color radios | true | active | Only available for One-Time scripts and widgets running in full screen mode. |
Change log¶
| EdgeTX version | Change |
|---|---|
| 2.11.1 | Introduced |