The only little disadvantage i see if i understand correctly is that MenuSystem has to iterate through items to create the array, and then the user has to iterate again through array to print names, what is little slower, but... all have a price.

Another cuestion: Why do you pass a pointer to MenuItem in the callback funtion?

Thinking about this library.. it could be used for anything that needs a tree structure, noy only a menu system.

I pass a pointer to the menu item to the callback so it knows what invoked it.

You're right about the double iteration. Still, optimising early is generally considered a bad idea. That said, I'm not totally against you're approach. I will try them both out

Finally, you're right again, this could be used for any tree structure. That is the intent of the composite design pattern. I wouldn't use this library for anything other than a menu system though.

Then LCD screen is refreshed at 10hz on another timed loop in the main loop.

This works almost well.When I stay inside the menu, I can go next, prev, back and select...I use click button to select, & long_press button to go back to the parent.

The problem is when I select an item in a submenu. Imagine I've selected CONFIGURATION/TILT/MIN_PWM. My current_activity change from #MENU" to "TILT_MINPWM". ( so the display_menu function is not called anymore. ) It then call another function to display the configuration screen on the LCD & handle configuring parameters.When I quit this screen, I change the current_status to "MENU", so it displays the menu again.The problem is it doesn't go back to the previous menu state, it just start from the Root Menu, with the CONFIGURATION already selected.

I'd like to have it going back in menu_root/CONFIGURATION/SERVOS/TILT menu and not Root.

There's probably a mistake I've made somewhere, but I can't find it for now.

Apologies for those who left messages addressed to me. I didn't have notifications turned on, so have missed them.

@vidsondakI'm not sure because it's been a while since I've done any arduino development. My first thought is that the library isn't in the correct folder, but the error message is odd since "menu system" is written with a space in it. Did you make a typo by any chance?

@JoarleyRodriguesThere are examples included with the library, have you tried those out?

@kipkoolYou posted way, way back in March. I'm very sorry. Hopefully you've found an answer by now. If not, please raise an issue on github and I'll take a look. Why do I need a github issue? I'm away for a few weeks, and I tend to be active on github a lot, so when I return I will be reminded.

Thanks! I'm going away on holiday for a few weeks soon. I'll try and take a look before then, otherwise I'll handle it when I get back. It's nice that a solution is available in the meantime if people need it.

I had made a new example so that the user can navigate the menu over serial comands. The idea is to make easy to understand how to control the menu. I'll make a pull request of this example, but meanwhile you can found it herehttps://github.com/jonblack/menusystem/pull/4

I had made a new example so that the user can navigate the menu over serial comands. The idea is to make easy to understand how to control the menu. I'll make a pull request of this example, but meanwhile you can found it herehttps://github.com/jonblack/menusystem/pull/4

Is me again, I have a question:Is there a way to identify a selection other that by name.I want my serialHandler to react different if I'm in the menu, or if I'm in a selection. I want to make that, for example, when I select Level1 Item1 my serialHandler reacts accordingly and set a variable value using the same comands (the plan if in the future swap serial handler with a button handler). Any tips how to approach?

One idea that I have is to modify the lib so add an id to the MenuComponent

menusystem 1.0.0 has been released. See github for more information. This is the first release to have a version number, so it doesn't mean much at the moment. Also, I couldn't test this on an arduino because I've lost my usb cable....oops. It compiles fine, so hopefully all is well

@kipkoolI've merged in your pull-request. What you wrote here in the forum was different to the pull request. I changed the pull request to match what you have here, but also making the default behaviour the same as always (return to the root menu).

@niesteszeckI've merged in your examples as well. I renamed the files to match the format of the existing ones. A small thing, I know .

As for your other question, I'm not sure I understand completely what you're trying to achieve. Your handler should be called directly when you select a menu item, so you shouldn't need to store what was selected. What is your use case for tracking the menu selection outside of the library (by returning the id)?