Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SubMenu does not respond unless extra menu item is added #428

Open
cytan299 opened this issue Oct 4, 2023 · 0 comments
Open

SubMenu does not respond unless extra menu item is added #428

cytan299 opened this issue Oct 4, 2023 · 0 comments

Comments

@cytan299
Copy link

cytan299 commented Oct 4, 2023

Hi,
I'm having a problem that looks like a memory overwrite problem. I made a submenu with 3 items:

MENU(GenMenu, "General", doNothing,noEvent,wrapStyle,
     OP("Battery", menu_item_battery_status, (eventMask)(focusEvent | blurEvent)),
     OP("About", menu_item_about_status, (eventMask)(focusEvent | blurEvent)),
     EXIT("<BACK")
     );

And when I press on the EXIT(), menu_item_battery_status() is executed. The other menu items when selected, don't call any of the callbacks.

Now, when I add in another menu item, lablelled "Sound" below, everything works:

MENU(GenMenu, "General", doNothing,noEvent,wrapStyle,
     OP("Sound", menu_item_sound_status, enterEvent),
     OP("Battery", menu_item_battery_status, (eventMask)(focusEvent | blurEvent)),
     OP("About", menu_item_about_status, (eventMask)(focusEvent | blurEvent)),
     EXIT("<BACK")
     );

I checked the generated code after macro expansion, and I get this for

Broken with 3 menu items:

const char title_52[] ="Battery";
Menu::promptShadows opShadows52={ (Menu::callback)menu_battery_status, _noStyle, title_52, (eventMask)(focusEvent | blurEvent), noStyle };
prompt op52(opShadows52.obj);


const char title_53[] ="About";
Menu::promptShadows opShadows53={ (Menu::callback)menu_about_status, _noStyle, title_53, (eventMask)(focusEvent | blurEvent), noStyle };
prompt op53(opShadows53.obj);

const char title_54[] ="<BACK";
Menu::promptShadows opShadows54 = { (Menu::callback)Menu::doExit, Menu::_Exit, title_54, Menu::enterEvent };
Menu::prompt op54(opShadows54.obj);

const char GenMenu_text[] ="General";
Menu::prompt* GenMenu_data[] ={ &op52, &op53, &op54, };
Menu::menuNodeShadows GenMenuShadows={ (Menu::callback)doNothing, (Menu::systemStyles)((Menu::_menuData|Menu::_canNav)|Menu::_menuData|Menu::_canNav), GenMenu_text, noEvent, wrapStyle, sizeof(GenMenu_data)/sizeof(Menu::prompt*), GenMenu_data };
Menu::menu GenMenu(GenMenuShadows.obj);

Works with 4 menu items:

const char title_52[] ="Sound";
Menu::promptShadows opShadows52={ (Menu::callback)menu_sound_status, _noStyle, title_52, enterEvent, noStyle };
prompt op52(opShadows52.obj);


const char title_53[] ="Battery";
Menu::promptShadows opShadows53={ (Menu::callback)menu_battery_status, _noStyle, title_53, (eventMask)(focusEvent | blurEvent), noStyle };
prompt op53(opShadows53.obj);


const char title_54[] ="About";
Menu::promptShadows opShadows54={ (Menu::callback)menu_about_status, _noStyle, title_54, (eventMask)(focusEvent | blurEvent), noStyle };
prompt op54(opShadows54.obj);


const char title_55[] ="<BACK";
Menu::promptShadows opShadows55 = { (Menu::callback)Menu::doExit, Menu::_Exit, title_55, Menu::enterEvent };
Menu::prompt op55(opShadows55.obj);

const char GenMenu_text[] ="General";
Menu::prompt* GenMenu_data[] ={ &op52, &op53, &op54, &op55, };
Menu::menuNodeShadows GenMenuShadows={ (Menu::callback)doNothing, (Menu::systemStyles)((Menu::_menuData|Menu::_canNav)|Menu::_menuData|Menu::_canNav), GenMenu_text, noEvent, wrapStyle, sizeof(GenMenu_data)/sizeof(Menu::prompt*), GenMenu_data };
Menu::menu GenMenu(GenMenuShadows.obj);

For the life of me, I can't see any code differences (besides the numbering) between the two macro expansions. So is there some memory setting or Menu settings that I have to change to get the above 3 menu time code to work?

Thanks for any pointers
cytan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant