Skip to content
Logo LogoLcdMenu
Docs Changelog License
⌘ K
Logo LogoLcdMenu
Docs Changelog License

Overview

  • Getting started
  • Menu Screen
  • Item overview
    • Basic menu item
    • Value display item
    • Command menu item
    • Sub-menu item
    • Item Widget
    • Item List
    • Item Range
    • Item Bool
    • Input item
    • Charset input item
  • Widget overview
    • WidgetBool
    • WidgetList
    • WidgetRange
  • Controlling the menu
    • Keyboard Adapter
    • Button Adapter
    • Rotary Encoder Adapter
    • Analog Button Adapter
  • Rendering the menu
    • Character display renderer

Reference

  • Code samples
    • InputRotary
    • SubMenu
    • SimpleRotary
    • IntFloatValues
    • SimpleInput
    • KeyboardAdapter
    • pcf8574_i2c
    • ItemValue
    • RTOS
    • KeypadShield
    • ViewShifting
    • MenuTimeout
    • DynamicMenu
    • ButtonWithRotaryAdapter
    • UseByRef
    • List
    • ItemBack
    • Basic
    • Widgets
    • Callbacks
    • CharsetInput
    • SSD1803A_I2C
    • ButtonAdapter
  • API reference
    • MenuItem
    • ItemCommand
    • MenuScreen
    • ItemBool
    • ItemInput
    • ItemSubMenu
    • ItemToggle
    • ItemInputCharset
    • ItemValue
    • ItemWidget
    • ItemRange
    • BaseItemManyWidgets
    • ItemList
    • ItemBack
    • LcdMenu
    • BaseItemZeroWidget
    • renderer
    • input
    • display
    • widget
  • Migration
  • FAQ

Star on GitHub
Edit on GitHub
Arduino Library Badge PlatformIO Badge Check Runs Badge Documentation Status Badge GitHub Commits Badge

LcdMenu
/
API reference
/
MenuItem

MenuItem

Defines

ITEM_DRAW_BUFFER_SIZE
ITEM_BASIC(...)
class MenuItem
#include <MenuItem.h>

Represent single item in menu.

┌────────────────────────────┐
│ > T E X T                  │
└────────────────────────────┘

Subclassed by BaseItemManyWidgets, BaseItemZeroWidget, ItemInput, ItemToggle

Public Functions

inline MenuItem(const char *text)
inline const char *getText()

Get the text of the item.

Returns:

String - Item’s text

inline void setText(const char *text)

Set the text of the item.

Note

You need to call LcdMenu::refresh after this method to see the changes.

Parameters:

text – text to display for the item

virtual ~MenuItem() noexcept = default

Protected Functions

inline uint8_t getViewSize(MenuRenderer *renderer) const

The number of available columns for the potential value of the item.

         visible area
       ┌───────────────┐
X X X X│X X X X █ X X X│X X
       ├───────────────┤
       │<── viewSize ─>│

Effectively const, but initialized lately when renderer is injected.

inline virtual bool process(LcdMenu *menu, const unsigned char command)

Process a command decoded in 1 byte. It can be a printable character or a control command like ENTER or LEFT. Return value is used to determine operation was successful or ignored. If the parent of item received that handle was ignored it can execute it’s own action on this command. Thus, the item always has priority in processing; if it is ignored, it is delegated to the parent element. Behaviour is very similar to Even Bubbling in JavaScript.

Parameters:
  • menu – the owner menu of the item, can be used to retrieve required object, such as DisplayInterface or MenuScreen

  • command – the character command, can be a printable character or a control command

Returns:

true if command was successfully handled by item.

inline virtual void draw(MenuRenderer *renderer)

Draw this menu item on specified display on current row.

Parameters:

renderer – The renderer to use for drawing.

Protected Attributes

const char *text = NULL
bool polling = false

Private Members

friend MenuScreen
API reference
ItemCommand

On this page

  • ITEM_DRAW_BUFFER_SIZE
  • ITEM_BASIC
  • MenuItem
    • MenuItem()
    • getText()
    • setText()
    • ~MenuItem()
    • getViewSize()
    • process()
    • draw()
    • text
    • polling

© 2025, Thomas Forntoh