tcMenu
Public Member Functions | List of all members
MenuEditingKeyListener Class Reference

#include <tcMenuKeyboard.h>

Inheritance diagram for MenuEditingKeyListener:

Public Member Functions

 MenuEditingKeyListener (uint8_t enterKey=' *', uint8_t deleteKey='#', uint8_t backKey='A', uint8_t nextKey='B')
 
void keyPressed (char key, bool held) override
 
void keyReleased (char key) override
 
void createInternalEncoder ()
 

Detailed Description

An implementation of the key listener that can be used with TcMenu to edit menu items and control the menu where nearly all types of menu item and navigation are supported. For some cases it may be beneficial to have a rotary encoder with center button, but it is not needed as every menu operation can be performed via the keyboard.

If you have enough keys you can set two keys to be next and back, where they will allow the next menu item to become When not in edit mode, the keyboard 0-9 keys can be used to select items where 1 is the first item to select. For any keys you do not wish to map, set them to KEY_NOT_CONFIGURED or -1.

If you are not using this class alongside an encoder of some kind, then you should use the helper method to create a null rotary encoder interface which is needed by the library.

Constructor & Destructor Documentation

◆ MenuEditingKeyListener()

MenuEditingKeyListener::MenuEditingKeyListener ( uint8_t  enterKey = '*',
uint8_t  deleteKey = '#',
uint8_t  backKey = 'A',
uint8_t  nextKey = 'B' 
)
explicit

Construct the key listener that will control TcMenu based on key presses. It is passed as the listener to an instance of IoAbstraction's KeyboardManager. You can set which keys act in certain roles such as enter and delete.

Parameters
enterKeythe key code for enter - defaulted to '#'
deleteKeythe key code for del/exit, defaulted to '*'
backKeythe key code for back, defaulted to 'A'
nextKeythe key code for next, defaulted to 'B'

Member Function Documentation

◆ keyPressed()

void MenuEditingKeyListener::keyPressed ( char  key,
bool  held 
)
override

Implements the key pressed interface method from KeyboardListener, this should not be called by user code

Parameters
keythe keycode
heldif it is held down.

◆ keyReleased()

void MenuEditingKeyListener::keyReleased ( char  key)
override

Implements the key released interface method from KeyboardListener, this should not be called by user code

Parameters
keythe keycode

◆ createInternalEncoder()

void MenuEditingKeyListener::createInternalEncoder ( )

Create a basic rotary encoder that fulfils the duties of the interface but does not do anything else, without this some parts of TcMenu no longer work, there is a dependency on a rotary encoder interface of some kind being present. Do not use if already implementing the encoder.


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