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?

Thanks.

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).

1 Like

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.

Mark

Ok, I’m back trying to make to do this. I started simply by testing if the popup would work. First I send a command the cases the showPopup function. That worked.
But when I send a hidePopup, nothing would happen.
SO with the debugger I found the even though the popup was open, the window was not active so the hidepop up simply returned.

I tried to put the hidepopup immediately after the showpopup and the debugger shows it was not active then either.

I tried to step through the show popup but did not find anywhere that it sets the active flag.

Has anyone ever done anything like this before? It does not seem the show and hide function are working correctly (Or just don’t understand what the the do and why).

Mark