Skip to content
Rui Azevedo edited this page Nov 2, 2017 · 7 revisions

Navigation options

Global config options

Global options are just a pointer to config object, providing some customization.

A different object pointer can be provided at any time.

V4.x options

valid from V4.0.7

char selectedCursor;//='>'; selected option text cursorchar disabledCursor;//='-'; disabled option text cursorconst navCodesDef &navCodes;//=defaultNavCodes; reference to existing navigation chars/commands tablebool 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 usedbool canExit=true;//v4.0 moved from global optionsbool useUpdateEvent=false;//if false, use enterEvent when field value is changed.idx_t inputBurst=1;//limit of inputs that can be processed before output

V3.x options

structconfig {
char selectedCursor;//='>';char disabledCursor;//='-';bool invertFieldKeys;//=false;bool nav2D;//=false;// N/A should be falseconst 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 menuinlinechargetCmdChar(navCmds cmd) const {return navCodes[cmd].ch;}
};

to provide new options:

on V4.x

config myOptions('*','-',defaultNavCodes,false);
voidsetup() {
options=&myOptions;//can customize options//...
}

on V3.x

config myOptions(
'>',//character used as cursor on enabled options'-',//character used as cursor on disabled optionsfalse,//invert up/down keys between nav and field editfalse,//2D Nav - not implemented yet
defaultNavCodes,//use default navigation characters '[+] [-] [\*] [/]'true,//use updateEventtrue//can exit from main menu
);
...
options=&myOptions;

Navigation characters/commands table

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

structnavCode {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}
};

Clone this wiki locally