tcMenu
Loading...
Searching...
No Matches
TextMenuItem Class Reference

#include <RuntimeMenuItem.h>

Inheritance diagram for TextMenuItem:
EditableMultiPartMenuItem RuntimeMenuItem MenuItem

Public Member Functions

 TextMenuItem (RuntimeRenderingFn customRenderFn, menuid_t id, int size, MenuItem *next=nullptr)
 TextMenuItem (RuntimeRenderingFn customRenderFn, const char *initial, menuid_t id, int size, MenuItem *next=nullptr)
 TextMenuItem (const AnyMenuInfo *info, const char *initial, int size, MenuItem *next=nullptr, bool isPgm=INFO_LOCATION_PGM)
 TextMenuItem (const AnyMenuInfo *info, RuntimeRenderingFn customRenderFn, const char *initial, int size, MenuItem *next=nullptr, bool isPgm=INFO_LOCATION_PGM)
void setPasswordField (bool pwd)
bool isPasswordField () const
uint8_t textLength () const
void setTextValue (const char *text, bool silent=false)
const char * getTextValue () const
void cleanUpArray ()
bool setCharValue (uint8_t location, char val)
bool valueChangedFromKeyboard (char keyPress)
Public Member Functions inherited from EditableMultiPartMenuItem
 EditableMultiPartMenuItem (MenuType type, menuid_t id, int numberOfParts, RuntimeRenderingFn renderFn, MenuItem *next=nullptr)
 EditableMultiPartMenuItem (const AnyMenuInfo *rtInfo, bool isPgm, MenuType type, int numberOfParts, RuntimeRenderingFn renderFn, MenuItem *next=nullptr)
uint8_t beginMultiEdit ()
int changeEditBy (int amt)
int previousPart ()
int nextPart ()
int getCurrentRange () const
void stopMultiEdit ()
int getPartValueAsInt () const
bool valueChanged (int newVal)
Public Member Functions inherited from RuntimeMenuItem
 RuntimeMenuItem (MenuType menuType, menuid_t id, RuntimeRenderingFn renderFn, uint8_t itemPosition, uint8_t numberOfRows, MenuItem *next=nullptr)
 RuntimeMenuItem (const AnyMenuInfo *rtInfo, bool isPgm, MenuType menuType, RuntimeRenderingFn renderFn, uint8_t itemPosition, uint8_t numberOfRows, MenuItem *next=nullptr)
void copyValue (char *buffer, int bufferSize) const
void runCallback () const
int getRuntimeId () const
int getRuntimeEeprom () const
uint8_t getNumberOfParts () const
void copyRuntimeName (char *buffer, int bufferSize) const
uint8_t getNumberOfRows () const
uint8_t getItemPosition () const
void setNumberOfRows (uint8_t rows)
Public Member Functions inherited from MenuItem
uint8_t copyNameToBuffer (char *sz, int size) const
uint8_t copyNameToBuffer (char *sz, int offset, int size) const
menuid_t getId () const
uint16_t getMaximumValue () const
uint16_t getEepromPosition () const
MenuType getMenuType () const
void triggerCallback () const
bool isInfoProgMem () const
void setChanged (bool changed)
void setChanged (int num, bool changed)
bool isChanged (int num=0) const
bool isSendRemoteNeeded (uint8_t remoteNo) const
void setSendRemoteNeededAll ()
void clearSendRemoteNeededAll ()
void setSendRemoteNeeded (uint8_t remoteNo, bool needed)
void setReadOnly (bool active)
bool isReadOnly () const
void setLocalOnly (bool localOnly)
bool isLocalOnly () const
void setSecured (bool secured)
bool isSecured () const
void setVisible (bool visible)
bool isVisible () const
MenuItemgetNext () const
void setNext (MenuItem *pNext)
void changeOccurred (bool silent)

Additional Inherited Members

Protected Member Functions inherited from MenuItem
 MenuItem (MenuType menuType, const AnyMenuInfo *menuInfo, MenuItem *next, bool infoProgMem)
Protected Attributes inherited from RuntimeMenuItem
menuid_t id
uint8_t itemPosition
uint8_t noOfParts
Protected Attributes inherited from MenuItem
uint16_t flags
MenuItemnext
const AnyMenuInfoinfo = nullptr
RuntimeRenderingFn renderFn = nullptr
MenuType menuType

Detailed Description

An item that can represent a text value that is held in RAM, and therefore change at runtime. We now manually configure the settings for this menu item in the constructor. This variant gets the name from program memory. The default render function for this type is: textItemRenderFn

Constructor & Destructor Documentation

◆ TextMenuItem() [1/4]

TextMenuItem::TextMenuItem ( RuntimeRenderingFn customRenderFn,
menuid_t id,
int size,
MenuItem * next = nullptr )

Create a text menu item using a RuntimeRenderingFn to handle all elements of the item, including the name and eeprom, this requires you to define a custom callback.

Parameters
customRenderFnthe custom callback render function
idthe ID of the item
sizethe size of the text array
nextoptionally, the next item in the linked list

◆ TextMenuItem() [2/4]

TextMenuItem::TextMenuItem ( RuntimeRenderingFn customRenderFn,
const char * initial,
menuid_t id,
int size,
MenuItem * next = nullptr )

Create a text menu item using a RuntimeRenderingFn to handle all elements of the item, including the name and eeprom, this requires you to define a custom callback.

Parameters
customRenderFnthe custom callback render function
initialthe initial value or nullptr
idthe ID of the item
sizethe size of the text array
nextoptionally, the next item in the linked list

◆ TextMenuItem() [3/4]

TextMenuItem::TextMenuItem ( const AnyMenuInfo * info,
const char * initial,
int size,
MenuItem * next = nullptr,
bool isPgm = INFO_LOCATION_PGM )

Create a text menu item using an info block that holds the name, eeprom and ID values, either in PGM or RAM. This version does not even need the render function to be provided, and uses the default.

Parameters
infothe info block with the static parameters
initialthe initial value or nullptr
sizethe size of the array for text
nextoptionally the next item

◆ TextMenuItem() [4/4]

TextMenuItem::TextMenuItem ( const AnyMenuInfo * info,
RuntimeRenderingFn customRenderFn,
const char * initial,
int size,
MenuItem * next = nullptr,
bool isPgm = INFO_LOCATION_PGM )

Create a text menu item using an info block that holds the name, eeprom and ID values, either in PGM or RAM. This version does not even need the render function to be provided, and uses the default.

Parameters
infothe info block with the static parameters
customRenderFnthe rendering function for cases when you wish to override rendering
initialthe initial value or nullptr
sizethe size of the array for text
nextoptionally the next item

Member Function Documentation

◆ isPasswordField()

bool TextMenuItem::isPasswordField ( ) const
inline
Returns
true if the field is being masked for password entry, otherwise false

◆ textLength()

uint8_t TextMenuItem::textLength ( ) const
inline
Returns
the max length of the text storage

◆ setTextValue()

void TextMenuItem::setTextValue ( const char * text,
bool silent = false )

Copies the text into the internal buffer.

Parameters
textthe text to be copied.
silentif the update should be notified via callback

◆ getTextValue()

const char * TextMenuItem::getTextValue ( ) const
inline
Returns
the text value in the internal buffer

◆ cleanUpArray()

void TextMenuItem::cleanUpArray ( )

Called after the array has been changed to ensure that it is in a good state for editing. IE zero's extended to the end.

◆ setCharValue()

bool TextMenuItem::setCharValue ( uint8_t location,
char val )

Set one character at a time of the value, use with care and ensure the string is always zero terminated if not taking the full space.

Parameters
locationthe location in the array
valthe character value
Returns
true if able to set, otherwise false

◆ valueChangedFromKeyboard()

bool TextMenuItem::valueChangedFromKeyboard ( char keyPress)

When working with keyboards this allows a value change in the form of a keypress to be decoded if possible by the text control. It triggers a RENDERFN_SET_TEXT_VALUE which is specific to text controls that need to be able to work with keyboard interfaces too.

Parameters
keyPressthe key on the keyboard that was pressed
Returns
true if successful otherwise false

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