So, I’ve got my menu class. In case someone who’s out of the loop reads this topic, my menu class does the following:
- Generates a GUI containing a list box with menu items;
- Adds event handlers (as C++ lambdas) for when the focus is changed (between all controls), when an element in the list box is toggled, and when a button is clicked;
- Adds two buttons (select and back) for submitting your selection to the system and going back a menu; and
- Adds sounds and nav groups to make interacting with controls easier.
It also adds accessibility to the menu. In case anyone wants it, I’ve attached my menu class (both header and source) as well as my nice bsAll.hpp header, which I use in my own project (saves me a lot of work including a bunch of headers). My difficulty is this: the function never returns. I’ll upload it as a little something for people to use in their projects once its finished and I can document it.
I’ve tried to have a return in the lambda event functions, but they don’t do anything. I have a statement in my main source code of my app that runs the menu, then speaks (through a screen reader) what choice you’ve selected. But when you hit ‘select’ in the menu, it plays its selection sound but doesn’t actually return anything, instead just sitting there quietly as if nothing actually happened. I know I messed up somewhere – but where? If anyone could help that would be great :)!
Edit: apparently I can’t upload files :(. Instead I’ll link to each file (I’d paste them, but the menu class is well over 100 lines long):
- bsAll.hpp: https://drive.google.com/file/d/15P3SSNwQvMnvukFzZoMaRD4TC0RbqM8p/view?usp=sharing
- menu.hpp: https://drive.google.com/file/d/15QuVjPTSvhK7qBZGvGyweOO8ppx8OYZY/view?usp=sharing
- menu.cpp: https://drive.google.com/file/d/15RB_aJq-881HKRn7LDta5ozhtRi0E2pk/view?usp=sharing
I’ve done my best with indenting, but I usually don’t indent my code (I’ll probably have an automated tool do it). I’ve incorporated cppcheck into the build but it still doesn’t catch the problem. Which is weird.