Combo Box values in Script Processor
-
OK I'm using a number of script processors (attached to Synthesiser Groups but thats not an issue)
Here's some of the code
const var myNote1 = Content.addComboBox("myCombo1", 300,10); myNote1.addItem("C"); myNote1.addItem("C#"); myNote1.addItem("D"); myNote1.addItem("D#"); myNote1.addItem("E"); myNote1.addItem("F"); myNote1.addItem("F#"); myNote1.addItem("G"); myNote1.addItem("G#"); myNote1.addItem("A"); myNote1.addItem("A#"); myNote1.addItem("B");
So pretty simple really, but....everytime I compile it adds these 12 values to the existing contents of the combo box, so how do I make it just do this once?
-
@Lindon Just write them straight into the list items in the interface designer.
-
@d-healey yeah I have quite a few to do - I'd like to do it programmatically if I can.
-
@Lindon Do it once then delete the code. It should add it in the interface designer if I remember correctly. If you want to leave it in the code you can use
myNote1.set("items", "A", "B", "C", etc.);
-
You can clear the list before adding the items by passing an empty string:
const var myNote1 = Content.addComboBox("myCombo1", 300,10); myNote1.set("items", ""); myNote1.addItem("C"); myNote1.addItem("C#"); myNote1.addItem("D"); myNote1.addItem("D#"); myNote1.addItem("E"); myNote1.addItem("F"); myNote1.addItem("F#"); myNote1.addItem("G"); myNote1.addItem("G#"); myNote1.addItem("A"); myNote1.addItem("A#"); myNote1.addItem("B");
-
@Christoph-Hart OK thanks
-
Slightly related query
ViewportList.set("items", "");
Doesn't behave as expected. It's like the component needs to be repainted/refreshed.