U8glib menu help

Hello !
I am making a watch and I need a menu, what I found is only 1/2 of what I need.

#define KEY_NONE 0
#define KEY_PREV 1
#define KEY_NEXT 2
#define KEY_SELECT 3
#define KEY_BACK 4

// DOGS102 shield configuration values
//uint8_t uiKeyPrev = 2;
//uint8_t uiKeyNext = 4;
//uint8_t uiKeySelect = 5;
//uint8_t uiKeyBack = 3;

// DOGM128-Shield configuration values
// DOGXL60-Shield configuration values
uint8_t uiKeyPrev = 7;
uint8_t uiKeyNext = 3;
uint8_t uiKeySelect = 2;
uint8_t uiKeyBack = 8;

uint8_t uiKeyCodeFirst = KEY_NONE;
uint8_t uiKeyCodeSecond = KEY_NONE;
uint8_t uiKeyCode = KEY_NONE;

void uiSetup(void) {
// configure input keys

pinMode(uiKeyPrev, INPUT); // set pin to input
digitalWrite(uiKeyPrev, HIGH); // turn on pullup resistors
pinMode(uiKeyNext, INPUT); // set pin to input
digitalWrite(uiKeyNext, HIGH); // turn on pullup resistors
pinMode(uiKeySelect, INPUT); // set pin to input
digitalWrite(uiKeySelect, HIGH); // turn on pullup resistors
pinMode(uiKeyBack, INPUT); // set pin to input
digitalWrite(uiKeyBack, HIGH); // turn on pullup resistors
}

void uiStep(void) {
uiKeyCodeSecond = uiKeyCodeFirst;
if ( digitalRead(uiKeyPrev) == LOW )
uiKeyCodeFirst = KEY_PREV;
else if ( digitalRead(uiKeyNext) == LOW )
uiKeyCodeFirst = KEY_NEXT;
else if ( digitalRead(uiKeySelect) == LOW )
uiKeyCodeFirst = KEY_SELECT;
else if ( digitalRead(uiKeyBack) == LOW )
uiKeyCodeFirst = KEY_BACK;
else
uiKeyCodeFirst = KEY_NONE;

if ( uiKeyCodeSecond == uiKeyCodeFirst )
uiKeyCode = uiKeyCodeFirst;
else
uiKeyCode = KEY_NONE;
}

#define MENU_ITEMS 4
char *menu_strings[MENU_ITEMS] = { "First Line", "Second Item", "3333333", "abcdefg" };

uint8_t menu_current = 0;
uint8_t menu_redraw_required = 0;
uint8_t last_key_code = KEY_NONE;

void drawMenu(void) {
uint8_t i, h;
u8g_uint_t w, d;

u8g.setFont(u8g_font_6x13);
u8g.setFontRefHeightText();
u8g.setFontPosTop();

h = u8g.getFontAscent()-u8g.getFontDescent();
w = u8g.getWidth();
for( i = 0; i < MENU_ITEMS; i++ ) {
d = (w-u8g.getStrWidth(menu_strings*))/2;*

  • u8g.setDefaultForegroundColor();*
  • if ( i == menu_current ) {*
    _ u8g.drawBox(0, i*h+1, w, h);_
  • u8g.setDefaultBackgroundColor();*
  • }*
    u8g.drawStr(d, ih, menu_strings);
    _
    }_
    _
    }_
    void updateMenu(void) {
    if ( uiKeyCode != KEY_NONE && last_key_code == uiKeyCode ) {
    _
    return;_
    _
    }_
    last_key_code = uiKeyCode;*

* switch ( uiKeyCode ) {*
* case KEY_NEXT:
menu_current++;
if ( menu_current >= MENU_ITEMS )
menu_current = 0;
menu_redraw_required = 1;
_
break;_
case KEY_PREV:
if ( menu_current == 0 )
menu_current = MENU_ITEMS;
menu_current--;
menu_redraw_required = 1;
_
break;_
_
}_
_
}_
void setup() {
_
// rotate screen, if required*_
* // u8g.setRot180();*

* uiSetup(); // setup key detection and debounce algorithm*
* menu_redraw_required = 1; // force initial redraw*
}
*void loop() { *
* uiStep(); // check for key press*

* if ( menu_redraw_required != 0 ) {
_
u8g.firstPage();_
_
do {_
_
drawMenu();_
_
} while( u8g.nextPage() );_
menu_redraw_required = 0;
_
}_
_
updateMenu(); // update menu bar*_

}
[/quote]
My menu items are:
- Clock
- Stopwatch
- BMP180
- Flashlight
I want when I press the button select to open the page of the sunction also each func to work separately from the others.
So can somebody explain show me how to make it ?