tcMenu
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ScrollChoiceBuilder Class Reference

Public Member Functions

 ScrollChoiceBuilder (AnyMenuInfo &info, TcMenuBuilder &parentBuilder, uint16_t initialValue, MenuFlags flags)
 
 ScrollChoiceBuilder (const ScrollChoiceBuilder &)=default
 
ScrollChoiceBuilderfromRamChoices (const char *fixedArray, int numItems, int fixedItemSize)
 Configures the scroll choice menu item using a fixed array of choices stored in RAM.
 
ScrollChoiceBuilderfromRomChoices (EepromPosition eepromPosition, int numItems, int fixedItemSize)
 Configures the scroll choice menu item using a fixed array of choices stored in EEPROM.
 
ScrollChoiceBuilderofCustomRtFunction (RuntimeRenderingFn rtRenderFn, int numItems)
 
ScrollChoiceBuildercachingEepromValues ()
 
TcMenuBuilderendItem () const
 Finalizes the configuration of the scroll choice menu item and returns control to the parent menu builder.
 

Member Function Documentation

◆ fromRamChoices()

ScrollChoiceBuilder & ScrollChoiceBuilder::fromRamChoices ( const char *  fixedArray,
int  numItems,
int  fixedItemSize 
)

Configures the scroll choice menu item using a fixed array of choices stored in RAM.

This method initializes and configures a ScrollChoiceMenuItem with a fixed array of choices located in RAM.

Note
If you use this method, you must set an EEPROM in menuMgr otherwise the item will not function correctly.

The array is of fixed length, meaning that each item takes a fixed size. Example with fixedLen=8, numEntries=3:

choiceString = "Option A Option B Option C "
^^^^^^^^ ^^^^^^^^ ^^^^^^^^
Entry 0 Entry 1 Entry 2
(index) (index) (index)
0 8 16

Each entry occupies exactly fixedLen characters. If the text is shorter than fixedLen, it should be padded with spaces or zero terminated. Entry N starts at position (N * fixedLen). * List Docs - https://tcmenu.github.io/documentation/arduino-libraries/tc-menu/menu-item-types/list-menu-item/ ScrollChoice Docs - https://tcmenu.github.io/documentation/arduino-libraries/tc-menu/menu-item-types/scrollchoice-menu-item/

Parameters
fixedArrayA pointer to a fixed array of choices stored in RAM.
numItemsThe total number of items available in the fixed array.
fixedItemSizeThe size (in bytes) of each individual choice in the array.
Returns
A reference to the current ScrollChoiceBuilder instance for method chaining.

◆ fromRomChoices()

ScrollChoiceBuilder & ScrollChoiceBuilder::fromRomChoices ( EepromPosition  eepromPosition,
int  numItems,
int  fixedItemSize 
)

Configures the scroll choice menu item using a fixed array of choices stored in EEPROM.

This method initializes and configures a ScrollChoiceMenuItem with a fixed array of choices located in EEPROM.

If you use this method, you must set an EEPROM in menuMgr otherwise the item will not function correctly.

The array is of fixed length, meaning that each item takes a fixed size. Example with fixedLen=8, numEntries=3:

choiceString = "Option A Option B Option C "
^^^^^^^^ ^^^^^^^^ ^^^^^^^^
Entry 0 Entry 1 Entry 2
(index) (index) (index)
0 8 16

Each entry occupies exactly fixedLen characters. If the text is shorter than fixedLen, it should be padded with spaces or zero terminated. Entry N starts at position (N * fixedLen).

List Docs - https://tcmenu.github.io/documentation/arduino-libraries/tc-menu/menu-item-types/list-menu-item/ ScrollChoice Docs - https://tcmenu.github.io/documentation/arduino-libraries/tc-menu/menu-item-types/scrollchoice-menu-item/

Parameters
eepromPositionoffset into the eeprom of the fixed array
numItemsThe total number of items available in the fixed array.
fixedItemSizeThe size (in bytes) of each individual choice in the array.
Returns
A reference to the current ScrollChoiceBuilder instance for method chaining.

◆ cachingEepromValues()

ScrollChoiceBuilder & ScrollChoiceBuilder::cachingEepromValues ( )

Reading from EEPROM is slow, you can optionally cache the values in RAM once loaded, improving read performance.

Returns
A reference to the current ScrollChoiceBuilder instance for method chaining.

◆ endItem()

TcMenuBuilder & ScrollChoiceBuilder::endItem ( ) const

Finalizes the configuration of the scroll choice menu item and returns control to the parent menu builder.

This method completes the building process of the menu item by finalizing its configuration to the associated ScrollChoiceMenuItem and integrates it into the menu structure. It then returns control to the parent TcMenuBuilder to allow for further menu items.

Returns
A reference to the parent TcMenuBuilder instance.

The documentation for this class was generated from the following files: