-
-
Notifications
You must be signed in to change notification settings - Fork 195
Options
Global options
are just a pointer to config object, providing some customization.
A different object pointer can be provided at any time.
valid from V4.0.7
char selectedCursor;//='>'; selected option text cursor
char disabledCursor;//='-'; disabled option text cursor
const navCodesDef &navCodes;//=defaultNavCodes; reference to existing navigation chars/commands table
bool invertFieldKeys;//global fields keys inversion flag (for code driven single input)
_note: some option have moved to other objects on v4.x.
numValueInput moved to menuIn object
navRoot extra options, previously on global options object
bool nav2D=false;//not used
bool canExit=true;//v4.0 moved from global options
bool useUpdateEvent=false;//if false, use enterEvent when field value is changed.
idx_t inputBurst=1;//limit of inputs that can be processed before output
struct config {
char selectedCursor;//='>';
char disabledCursor;//='-';
bool invertFieldKeys;//=false;
bool nav2D;//=false;// N/A should be false
const navCodesDef &navCodes;//=defaultNavCodes;
bool useUpdateEvent;//=false, if false, when field value is changed use enterEvent instead.
bool canExit;//=true, if false do not exit from main menu
inline char getCmdChar(navCmds cmd) const {return navCodes[cmd].ch;}
};
to provide new options:
on V4.x
config myOptions('*','-',defaultNavCodes,false);
void setup() {
options=&myOptions;//can customize options
//...
}
on V3.x
config myOptions(
'>',//character used as cursor on enabled options
'-',//character used as cursor on disabled options
false,//invert up/down keys between nav and field edit
false,//2D Nav - not implemented yet
defaultNavCodes,//use default navigation characters '[+] [-] [\*] [/]'
true,//use updateEvent
true//can exit from main menu
);
...
options=&myOptions;
This table provides a mapping between navigation command and character codes.
It is the table used to translate characters read from a stream into navigation commands.
This table unit is the navCode structure
struct navCode {navCmds cmd;char ch;};
the table can be indexed by a navCmd options->navCodes[upCmd]
, or the associated character obtained by options->getCmdChar(upCmd)
where:
cmd is one of the available navCmds
ch is the character code to be associated
the table is an array of 10 navCodes
const navCodesDef myCodes={
{noCmd,(char)0xff},
{escCmd,'/'},
{enterCmd,'*'},
{upCmd,'+'},
{downCmd,'-'},
{leftCmd,'-'},
{rightCmd,'+'},
{idxCmd,'?'},
{scrlUpCmd,0x35},
{scrlUpCmd,0x36}
};