Combox: how can I fill the list programmatically

A place for developers to share ideas and assist each other in solving problems.
Post Reply
DragonSF
Posts: 251
Joined: Sun Nov 08, 2015 4:28 pm

Combox: how can I fill the list programmatically

Post by DragonSF » Sat Oct 29, 2016 4:12 pm

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?

DragonSF
Posts: 251
Joined: Sun Nov 08, 2015 4:28 pm

Re: Combox: how can I fill the list programmatically

Post by DragonSF » Sun Oct 30, 2016 11:08 pm

I'm giving up, because the interface from pep to scopefx is here not campatible.

w_ellis
Posts: 422
Joined: Wed Nov 07, 2001 4:00 pm
Location: London, U.K.

Re: Combox: how can I fill the list programmatically

Post by w_ellis » Mon Oct 31, 2016 1:42 am

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)

DragonSF
Posts: 251
Joined: Sun Nov 08, 2015 4:28 pm

Re: Combox: how can I fill the list programmatically

Post by DragonSF » Mon Oct 31, 2016 3:29 am

ext midi.png
ext midi.png (10.92 KiB) Viewed 828 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.

User avatar
sunmachine
Posts: 352
Joined: Mon Mar 01, 2010 12:37 am

Re: Combox: how can I fill the list programmatically

Post by sunmachine » Mon Oct 31, 2016 8:26 am

It would be great if you could post your workaround here and/or in the SDK Wiki.
Might come in handy one day. :)

DragonSF
Posts: 251
Joined: Sun Nov 08, 2015 4:28 pm

Re: Combox: how can I fill the list programmatically

Post by DragonSF » Mon Oct 31, 2016 3:37 pm

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();

User avatar
sunmachine
Posts: 352
Joined: Mon Mar 01, 2010 12:37 am

Re: Combox: how can I fill the list programmatically

Post by sunmachine » Thu Nov 03, 2016 10:19 am

Thanks, DragonSF!

Post Reply