WidgetList

Functions

template<typename T>
inline BaseWidgetValue<T> *WIDGET_LIST(const T values[], const uint8_t size, const uint8_t activePosition = 0, const char *format = "%s", const uint8_t cursorOffset = 0, const bool cycle = false, void (*callback)(const T&) = nullptr)

Function to create a new WidgetList<T> instance.

Template Parameters:

T – The type of the value.

Parameters:
  • values – The list of values to choose from.

  • size – The size of the list.

  • activePosition – The initial active position in the list (default: 0).

  • format – The format of the value (default: “%s”).

  • cursorOffset – The cursor offset (default: 0).

  • cycle – Whether to cycle through the list (default: false).

  • callback – The callback function to call when the value changes (default: nullptr).

template<typename T>
class WidgetList : public BaseWidgetValue<T>
#include <WidgetList.h>

Widget that allows a user to select a value from a list. Manages a value within a specified list, allowing cycling through values.

Public Functions

inline WidgetList(const T values[], const uint8_t size, const int8_t activePosition, const char *format, const uint8_t cursorOffset, const bool cycle, void (*callback)(const T&))

Protected Functions

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

Process command.

Handle commands:

  • UP - increment value and trigger callback;

  • DOWN - decrement value and trigger callback;

inline void updateValue(const __FlashStringHelper *action)
inline bool nextValue()
inline bool previousValue()

Protected Attributes

const uint8_t size
uint8_t activePosition
const bool cycle
const T *values