I am working on a ComboBox variant that allows multiple selections (e.g. a menu where you can select/deselect audio channels). In order to apply selection changes to a large number of items rapidly, it should be possible to keep the PopupMenu open and for example toggle the selection state of the current item using the space bar.
In principle this is possible to implement in the PopupMenu’s MenuWindow class, but here’s the caveat: as it seems, the only way to communicate from the MenuWindow to the ComboBox is via the exitModalState function, which only allows a single integer as a return value. Is this correct or am I overlooking something?
Ideally, I would like to have a way to interact with the application’s logic whenever I detect that the space bar was pressed (which probably has to be within within MenuWindow because that’s the only place where I can change the tick marks while the menu is open). If that is not possible, a way to send an array of integers via exitModalState would be nice, too. For now I got it to work by encoding the items whose state was toggled by using the integer as a bit-map, but that limits me to menus with a maximum of 32 items (well, for audio channels that’s ok, but there may be other uses where this maximum number of items may be a problem).
I should note also that I’m doing this for a client who has a JUCE v3 license, so if you know if there’s a difference between the current JUCE version and v3 in this regard, it would be nice to point it out (maybe it would motivate my client to update, too…).
Thanks a lot in advance for your hints and best regards,