Library to display menus on TextLCDs. Interaction with functions Up,Down and Select (Buttons or RPG) Based on menu-library from pyeh9

Fork of Menu by Peihsun Yeh

Library to display menus on TextLCDs. Interaction with functions Up,Down and Select (Buttons or RPG) Based on menu-library from pyeh9

Files at this revision

API Documentation at this revision

Comitter:
charly
Date:
Fri Jan 02 20:49:59 2015 +0000
Parent:
5:91b1bc68290b
Child:
7:12f2b3b7975f
Commit message:
addes Method to Chnage Text of an MenuItem

Changed in this revision

Menu.cpp Show annotated file Show diff for this revision Revisions of this file
Menu.h Show annotated file Show diff for this revision Revisions of this file
Navigator.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/Menu.cpp	Fri Jan 02 15:41:09 2015 +0000
+++ b/Menu.cpp	Fri Jan 02 20:49:59 2015 +0000
@@ -12,4 +12,10 @@
     selections.push_back(toAdd);
 }
 
+void Menu::changeText(int position, char *newText)
+{
+    if ((position >=0) && (position <= selections.size())) {
+        selections[position].selText = newText;
+    }
+}
 
--- a/Menu.h	Fri Jan 02 15:41:09 2015 +0000
+++ b/Menu.h	Fri Jan 02 20:49:59 2015 +0000
@@ -17,6 +17,7 @@
         Menu(char *);
         
         void add(const Selection &toAdd);
+        void changeText(int position, char *newText);
         char *getText(int);
 };
 #endif
\ No newline at end of file
--- a/Navigator.cpp	Fri Jan 02 15:41:09 2015 +0000
+++ b/Navigator.cpp	Fri Jan 02 20:49:59 2015 +0000
@@ -56,6 +56,9 @@
     if(activeMenu->selections[_cursorPos].fun != NULL) {
         //execute function
         (activeMenu->selections[_cursorPos].fun)();
+        // refresh the Menu
+        printMenu();
+        printCursor();
     }
     if(activeMenu->selections[_cursorPos].childMenu != NULL) {
         activeMenu = activeMenu->selections[_cursorPos].childMenu;