Module menu
Functions for interacting with the ML menu
Info:
- Copyright: 2014
- License: GPL
- Author: Magic Lantern Team
visible |
Get whether or not the ML menu is visible |
Functions
-
new (definition)
-
Creates a new menu item
Parameters:
Returns:
a menu object
Usage:
mymenu = menu.new
{
parent = "Scripts",
name = "Lua Test Script",
help = "Some help for this script",
value = 1,
submenu =
{
{
name = "Run",
help = "Run this script.",
icon_type = ICON_TYPE.ACTION,
update = "",
},
{
name = "Parameter Example",
help = "Help for Parameter Example",
min = 0,
max = 100,
unit = UNIT.DEC,
warning = function(this) if this.value == 5 then return "this value is not supported" end end,
},
{
name = "Choices Example",
choices = { "choice1", "choice2", "choice3" },
}
},
update = function(this) return this.submenu["Choices Example"].value end,
}
mymenu.submenu["Run"].select = function()
print("Parameter Example= "..mymenu.submenu["Parameter Example"].value)
print("Choices Example= "..mymenu.submenu["Choices Example"].value)
end
-
set (menu, entry, value)
-
Set the value of some existing ML menu entry
Parameters:
- menu
name of the parent menu ('Audio', 'Expo', 'Overlay', 'Shoot', 'Movie', etc)
- entry
name of the menu entry
- value
the value to set
Returns:
whether or not the call was sucessful
-
get (menu, entry)
-
Get the value of some existing ML menu entry
Parameters:
- menu
name of the parent menu ('Audio', 'Expo', 'Overlay', 'Shoot', 'Movie', etc)
- entry
name of the menu entry
Returns:
the value of the menu entry
-
block (enaabled)
-
Block the ML menu from redrawing (if you wand to do custom drawing)
Parameters:
-
open ()
-
Open ML menu
-
close ()
-
Close ML menu
Fields
-
visible
-
Get whether or not the ML menu is visible
Class menu
Represents a menu item
-
menu.value
-
current value of the menu item
-
menu.name
-
Name for the menu item
-
menu.help
-
Help text for the menu item (line 1)
-
menu.help2
-
Help text for the menu item (line 2)
-
menu.advanced
-
Advanced setting in submenus
-
menu.depends_on
-
Dependencies for this menu item.
If the dependecies are not met, the item will be greyed out and a warning will appear at the bottom of the screen.
-
menu.edit_mode
-
Editing mode for the menu item
-
menu.hidden
-
Hidden from main menu
-
menu.icon_type
-
The type of icon to use for this menu item
-
menu.jhidden
-
Hidden from junkie menu
-
menu.max
-
The maximum value the menu item can have
-
menu.min
-
The minimum value the menu item can have
-
menu.selected
-
Whether or not the menu is selected
-
menu.shidden
-
Special hide, not toggleable by user
-
menu.starred
-
Present in "my menu"
-
menu.submenu_height
-
Submenu Height
-
menu.submenu_width
-
Submenu Width
-
menu.unit
-
The unit for the menu item's value
-
menu.works_best_in
-
Suggested operating mode for this menu item
-
menu.run_in_separate_task
-
Whether or not the backend should run 'select' in it's own task
- run_in_separate_task
bool
-
menu:select (delta)
-
Function called when menu is toggled
Parameters:
-
menu:update ()
-
Function called when menu is displayed. Return a string to be displayed.
Returns:
string
-
menu:info ()
-
Function called when menu is displayed. Return a string to be displayed in the info area (in green).
Returns:
string
-
menu:rinfo ()
-
Function called when menu is displayed. Return a string to be displayed on the right side of the menu item
Returns:
string
-
menu:warning ()
-
Function called when menu is displayed. Return a string when there is a warning (menu will be greyed out).
Returns:
string
-
menu.choices
-
List of strings to display as choices in the menu item
-
menu.submenu
-
Table of more menu tables that define a submenu
-
menu:remove ()
-
Removes this menu entry