neu-rah / ArduinoMenu

Arduino generic menu/interactivity system
GNU Lesser General Public License v2.1
948 stars 191 forks source link

callback in menuNode #343

Closed ferchinas closed 3 years ago

ferchinas commented 3 years ago

Hi Rui: I want to execute a function when entering a submenu. But if I add the callback function in the definition of the menuNode, when pressing "enter" the function is executed but it does not enter the menu.

menuNode & subMenu = * new menuNode ("SENSOR 0", sizeof (sensorData) / sizeof (prompt *), sensorData, (Menu::callback) sensorMenu_0_cb, enterEvent);

If I remove the action and eventMask parameters, I can correctly enter the submenu

menuNode & subMenu = * new menuNode ("SENSOR 1", sizeof (sensorData) / sizeof (prompt *), sensorData);

I tried to see if MENU_DEBUG gave me any information, but no message appears. Any idea what I may be doing wrong?

neu-rah commented 3 years ago

hi! is sensorMenu_0_cb returning proceed?

ferchinas commented 3 years ago

You are the best! Problem solved. It seems that I have not made major changes in the menu for a long time and I had not seen that now the callback functions return a value. Thank you very much