## Combox: how can I fill the list programmatically

Scope and XITE Development

Original topic on PlanetZ: https://forums.scopeusers.com/viewtopic.php?t=34628

#### Combox: how can I fill the list programmatically

Posted: Sat Oct 29, 2016 4:12 pm
by DragonSF
I'm designing an external MIDI-In module and I want to be able to select any available MIDI-Ins from the ComboBox. In order to do that, I need to fill the ComboBox with available MIDI-In devices. Anyone knows, how to accomplish that?

#### Re: Combox: how can I fill the list programmatically

Posted: Sun Oct 30, 2016 11:08 pm
by DragonSF
I'm giving up, because the interface from pep to scopefx is here not campatible.

#### Re: Combox: how can I fill the list programmatically

Posted: Mon Oct 31, 2016 1:42 am
by w_ellis
When I was mulling something similar before, my plan was to build the UI outside of Scope (using Juce) and then just launching it from within Scope (similar to how ScopeSync works)

#### Re: Combox: how can I fill the list programmatically

Posted: Mon Oct 31, 2016 3:29 am
by DragonSF

  ext midi.png (10.92 KiB) Viewed 5675 times

That was my first approach, but it can't be used as surface. I found a way to work around this. If you want to know, just send me the usual email.

#### Re: Combox: how can I fill the list programmatically

Posted: Mon Oct 31, 2016 8:26 am
by sunmachine
It would be great if you could post your workaround here and/or in the SDK Wiki.
Might come in handy one day.

#### Re: Combox: how can I fill the list programmatically

Posted: Mon Oct 31, 2016 3:37 pm
by DragonSF
Here you are:
1. Add to your module, which includes 1 or more ComboBoxes (CB), 3 pads for each CB: input 'index' and outputs 'max' and 'selected string'.
2. Add a 'SingleLineText' from Design/Surfaces and connect the 'Str'-Pad to 'selected string'
3. Add a TextFader from Design/surface/controls. In the pad list go to vars and create pad for 'max'. Connect 'value' to 'index' and 'max' to 'max'.
If proper programmed, you can select by using the taxt fader (move pressed mosue left/right within the field).
Proper program can look like:
int sel = asyncIn[INPAD_INDEX]->itg;
if (sel < extMidiGUI->midiOutputList->getNumItems())
{
extMidiGUI->midiOutputList->setSelectedItemIndex(sel, true);
extMidiGUI->setMidiOutput(sel);
}
String::CharPointerType item = extMidiGUI->midiOutputList->getItemText(extMidiGUI->midiOutputList->getSelectedItemIndex()).getCharPointer();
asyncOut[OUTPAD_SELECTION].str = (char *)item.getAddress();
asyncOut[OUTPAD_MAX].itg = extMidiGUI->midiOutputList->getNumItems();

#### Re: Combox: how can I fill the list programmatically

Posted: Thu Nov 03, 2016 10:19 am
by sunmachine
Thanks, DragonSF!