tcMenu: Bad Documentation: menuMgr.navigateToMenu makes menu unable to scroll up

How to reproduce:

  1. Open Example simpleU8g2
  2. Add menuMgr.navigateToMenu(&menuSettings, &menuSettingsSaveSettings); to the end of onStartToasting function
  3. Run the firmware, select Start toasting >>
  4. the menu will focus on Settings, and unable to move the cursor up.

p.s. But if I change the code to menuMgr.navigateToMenu(&rootMenuItem(), &menuSettings), it will focus on Settings and free to scroll up and down.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 19 (10 by maintainers)

Most upvoted comments

I have another thought about this argument.

image

What if the menu is not a customed one, but I say customMenu=true, will it be stored in the history? If the essence is whether storing to the history or not, how about naming it to something like skipHistory?

I totally agree, after your first few comments, I’ve known how to use menuMgr.navigateToMenu, It provides full functionality to menu navigation, I will have no problem using it later on.

Just share some new user experience here: When I wanted to navigate the menus at first, I did not lookup the document throughly (already scanned a few times for other problems), I just looked up the function list brought up by the IDE and find which function is likely to meet my needs. I found navigateToMenu, seems to be what I want, I tried it with a few combinations, and failed. My main confusion at that time was: I already know where I want to put my cursor on, why should I provide another menuItem. And my main ‘mistake’ is not adding .getChild() to the first argument. As a new user to this library, I encountered this obstacle, and other new users might encounter this too, bringing them a steeper learning curve.

Here is the document brought up by vscode: image I might mostly be misled by the description of the first argument. Here I see the word “root”, it immediately brought me to the concept of “root” in the Designer UI, which is the parent of the menu. But actually the first argument represent the first menuItem of the menu I want to display. Maybe change the description will solve the confusion, but I’ll never know for sure, because I can’t unlearn what I’ve already learned 😆 Since I’m not a native English speaker, I’m not able to provide any suggestions on the description, sorry for that.

As for providing another API like menuMgr.navigateAndActivate(thisItem), I will feel guilty if you add this to the library, it’s more redundant to the library than the first argument of menuMgr.navigateToMenu😆

Maybe optimize the description of the first argument is enough.