Register / Login  |  Desktop view  |  Jump to bottom of page

tcMenu Arduinio library » code based navigation

Author: Blueforcer
15/04/2022 17:13:31
Hello,

im not that good in C++ and im asking because i dont find any example for my needs smilie

I need to navigate the menu with code. So im searching for something to simulate button clicks.
But everything ive found needs gpio pins.

Is there something like switches.performRightClick() or something like that?

thanks in advance
Stephan

Author: davetcc
16/04/2022 07:05:03
There's a couple of things you can do, firstly you can simulate a click in switches, if you wanted to go that way, on switches there is a handy function for testing -

void pushSwitch(pinid_t pin, bool held);


However, preferably you can use the navigation facilities on menu manager (menuMgr) -

void MenuManager::navigateToMenu(MenuItem* theNewItem, MenuItem* possibleActive, bool customMenu)

void MenuManager::resetMenu(bool completeReset) // complete reset - true means go back to root, otherwise one level back

Author: Blueforcer
16/04/2022 20:39:21
But
void pushSwitch(pinid_t pin, bool held);


will not work if there is no pin configurated, right?
Or can i use dummy pins?

I think something like that would be more easier than building the navigation from scratch.
So you can use nearly everything to navigate without having any hardwarepins declared.




Author: Blueforcer
16/04/2022 21:14:25
short feedback:

i just used pins in the designer wich doesnt exit ( 50,51,52 ..)
And it works just fine.
I will use this istead of building my own navigation smilie

Author: davetcc
19/04/2022 08:56:05
As per the last post, You can also use

navigateToMenu and resetMenu to avoid that. It lets you push a new menu and pop back on level or back to root.

You can also use takeOverDisplay when you want to show something completely custom.

See https://www.thecoderscorner.com/products/arduino-libraries/tc-menu/menumanager-and-iteration/

Author: Blueforcer
19/04/2022 09:18:11
 
davetcc wrote:As per the last post, You can also use

navigateToMenu and resetMenu to avoid that. It lets you push a new menu and pop back on level or back to root.

You can also use takeOverDisplay when you want to show something completely custom.

See https://www.thecoderscorner.com/products/arduino-libraries/tc-menu/menumanager-and-iteration/


Sure but that means that i have to build the complete navigation procedure myself including changing values etc. wich the lib already provides.
And all that effort just because i dont have Pins to trigger the existing functions of the lib. It doesnt worth in my opinion.
a software input plugin would be the greatest.
So the user can use nearly everything to navigate the menu. Like GestureSensors etc.
Somthing like
MenuMgr.performleftClick
MenuMgr.performDownClick
MenuMgr.performOkClick

But anyway. pushSwitch was the easiest way to get to my goal.


Author: davetcc
19/04/2022 12:19:47
Not really you can make any sub menu the current one by calling menuMgr.navigateToMenu(&mySubMenu)

You can simulate going back menuMgr.resetMenu(fullReset) where it either goes back one level or if the parameter is true, back to root.

This way, menu control is done for you, you are just manually controlling what submenu is being shown.

Author: davetcc
19/04/2022 12:24:09
i think these functions kind of do what you want:

https://www.thecoderscorner.com/products/arduino-libraries/tc-menu/menumanager-and-iteration/#controlling-the-menu-items-manually




Register / Login  |  Desktop view  |  Jump to top of page