Go Down

Topic: MenuBackend, new menu managment library (Read 77442 times) previous topic - next topic



The bug in 1.2 got introduced by my being stupid.
When elements are added I use a set method, and that takes a position parameter (above,right etc), but for version 1.2 I also added the constants MenuItem::ABOVE/RIGHT etc for checking against the hasChildren. I had to change the names of my internal representation of the directions in order to avoid naming conflicts, but forgot to change the identifying names in my switch/case in the set method.
Stupid, but easily fixable.

Could you test if this works:

if (menu.getCurrent().hasChildren() & (MenuItem::ABOVE | MenuItem::BELOW))
 Serial.println("The current item has either an element below or above");

Thank you for your contribution with this library!


I made a test last nite, and added some serial navigation (using 1.0).
So far I like it a lot.  I will try to re-test with your latest tonite.

I did confirm to myself that jumping to the root, or top menus would be helpful.  You definitely get a feel for this with the serial nav.   Going down 4 steps, and seeing that to return you have to go up 4 steps.



I figured that was the case with the bug.  I had compared the new and old code and saw that there was a difference is some of the internal variables.

Anyways, when I test what you asked I get this.
Code: [Select]
In function 'void loop()':
error: 'ABOVE' is not a member of 'MenuItem'



Nice library, I will definitely test more and give you some feedback.


Feedback is awesome! I am insanely busy these days, but I regulary check this forum, and will try to make suggested changes when I have time.
Last two weeks of my bachelor degree study... one 50 page dissertation and some exams. :)


Get busy and graduate you lug !

Then we have work for you to do!

Seriously, congrats on getting out of school.


I agree, finishing school and getting diploma is priority. Got one myself :).
I have some problems with the menubackend,  but it might be me, I'm arduino noob. I will test it later today ...


Hello again,

tested your menu, and it is working just fine. Used a rotary encoder, buttons and LCD for navigation. Well I must say I was getting some misbehavior, before I understood that the menu is made that way. That it is made for four cursor keys.

Here come my question, would it be hard to change the menubackend to work with buttons like left, right, select and exit. It would be very convenient to use it with rotary encoder left-right. Push button on rotary as select and one other button as exit.

Also a suggestion for your code to include exit of current level of menu   on any item not just on top one.



You can try to use moveBack(); if you want to exit a level.

You can inmplement what you ask yourself, actually.
If you only add menu items to the left or to the right, you end up with a horizontal structure, witch you can navigate with moveLeft(); and moveRight(); and select with use();.


Hello again,

tried your advice.  moveBack(); just move back one step in menu. But the rest is working just fine.

Can you maybe show me how to implement menuExit routine in your C. Which will do the following, but without showing it all on menu?

Code: [Select]
while ((menu.getCurrent().hasChildren() & MenuItem::LEFT) == 0){


What exactly do you want a menuExit(); to do?  :)


Well, the same as the code I posted.  :) Only not to show it all through  menuChangeEvent on LCD. That is menu.moveLeft(); but not only on most top one menu but on any item in same up-down level.


Th code you posted looks to be a bit specific to what you want. Care to explain the principle so I might make it something that could be useful for more users? :)


Not exactly sure what do you mean. As I explained before in this thread, I'm tying to put simple menu on LCD. Menu that can be managed by a rotary with push button on it as select, and one extra button as exit. Your menubackend is working fine for this, but I'm not C programmer. Tried some liked lists and pointers but not able to achieve same efficiency as your code. So I'm lost how to put this while statement without showing the progress on LCD.


So then my question is: Exit to where?

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131