How to update value in a menu item on runtime?
You can update the value of an ItemInput
in the loop
function by calling menu.getItemAt(
``position``
)->setValue(
"your new value here"
)
Examples:
menu.getItemAt(``your position``)->setValue("your new value here")
menu[``your position``]->setValue("your new value here")
menu[``your position``][``your sub position``].setValue("your new value here")
1.
and 2.
are the same, 3.
will change the value of the item at ``your sub position``
in the submenu at ``your position``
You can also use [menu.getCursorPosition()]
in place of menu.[``your position``]
if your cursor is on your desired menu item.
Index/position starts from 1
How to completely hide the menu?
There is a hide()
and a show()
function, calling hide will clear the display, thereby hiding the menu.
How to get the parent menu item from a submenu?
Getting the item at index = 0
from the menu will give you the ItemHeader
, from there you can get the parent menu of the current menu.
Calling getSubMenu()
on an ItemHeader
returns the parent menu of the submenu where the ItemHeader
is.