Control surface and combobox


I have midi built a control surface to interact with my juce based mixer. I use a combo box for picking filter types of eq filters. I want to use a rotary encoder with a push button to control the combo box. My thought is to push and hold the encoder which would popup the list with the current filter selected. Then rotating the encoder to change the selection up or down and then releasing the button would make the final selection.

I have not tried this yet but was hoping I could do something like this:
call showPopup(), setSelectedId(), hidePopup().

Will I get the selection change in the popup when the selectedid is called or is there another way to do it?
Will I get the listener callback after I close it?



I’ve not tested it, but probably the easiest way of doing this would be to simulate what happens when interacting with a ComboBox using the keyboard. So when the button is pushed, you call showPopup() and then simulate up/down key events when the user rotates the encoder as calling setSelectedId() won’t handle the highlighting of the item in the popup menu (which I’m guessing is what you want to happen when the user scrolls). Then when the user releases the button you’ll want to simulate the return key being pressed as this will select the currently highlighted item and hide the popup menu (it will also call any listeners).


I’m traveling now and will be away for a few more days so cannot try this now. Just trying to decide the best approach when I get back.

I think simulating mouse clicks would work too. Not sure which would be easier.