BaseWidget
-
class BaseWidget
- #include <BaseWidget.h>
Base class for widgets.
Subclassed by BaseWidgetValue< bool >, BaseWidgetValue< T >
Protected Functions
-
virtual bool process(LcdMenu *menu, unsigned char command) = 0
Process a command decoded in 1 byte. It can be a printable character or a control command like
ENTER
orLEFT
. Return value is used to determine if the operation was successful or ignored. If the item’s handler ignores the command, the parent can execute its own action on this command. Thus, the item always has priority in processing; if it ignores a command, the command is delegated to the parent element. This behavior is similar to event delegation, where an event is handled by the most specific handler first, and if not handled, it is passed up to more general handlers.- Parameters:
menu – the owner menu of the item, can be used to retrieve required objects, such as
MenuRenderer
orMenuScreen
command – the character command, can be a printable character or a control command
- Returns:
true if the command was successfully handled by the item.
Protected Attributes
-
const uint8_t cursorOffset
This member variable specifies the position where the cursor should be placed within the widget’s text. For example, if the text format is “%dms” (20ms) and the user wants the cursor to be placed at the position of “%d”, they would set cursorOffset to 2. By default, the cursor is placed at the end of the resulting text.
Friends
- friend class ItemWidget
- friend class BaseItemManyWidgets
-
virtual bool process(LcdMenu *menu, unsigned char command) = 0