Controls
The following controls exist for the menu
This library already contains pre-made menu control helpers that you can use and extend.
To use the existing helpers, add the following import (preferably after all imports)
Then do the following in the loop function
processMenuCommand
has multiple definitions depending on the type of menu items you have in your menu. See commandProcessors.h and the example code.
Under the hood, commandProcessors use the following functions, you can use them directly if you don't want to use the helpers provided.
menu.up()
and menu.down()
menu.up()
and menu.down()
Navigate up and down the menu. When the menu is in edit mode, this action has no effect.
menu.left()
and menu.right()
menu.left()
and menu.right()
If the menu is in edit mode,
for
ITEM_INPUT
it moves along the characters of the value.for
ITEM_STRING_LIST
it cycles through the items.for
ITEM_PROGRESS
it decrements and increments the progress respectively
menu.enter()
menu.enter()
If the active item is:
ITEM_INPUT
,ITEM_STRING_LIST
orITEM_PROGRESS
It goes into edit mode.ITEM_COMAND
orITEM_TOGGLE
it executes the bound callbackITEM_SUBMENU
it enters the sub-menu.
menu.back()
menu.back()
If the current menu displayed is a sub-menu, it navigates back to the parent menu.
If the current item is ITEM_INPUT
, ITEM_STRING_LIST
or ITEM_PROGRESS
it exits edit mode and executes the callback bound to the item.
menu.backspace()
menu.backspace()
If the current item is ITEM_INPUT
, it removes one character from the end of the current value.
menu.type(
character
)
menu.type(
character
)
If the current item is ITEM_INPUT
, it appends one character at the current cursor position to the current value of the item.
menu.drawChar(
character
)
menu.drawChar(
character
)
It does the same as type but doesn't set the value, it just draws it to the display.
Last updated