Set combobox value from played midi note
-
Hey guys,
I am trying to set up "learn note" system for my drum mapping.
The idea is that when a button is pressed and a note played, a relevant combobox is then set to this note (value). Combobox consenquately should change the mapping, as if I was doing it manually with a mouse.This is what I have onNoteOn
if (ButtonLearnNote1.getValue() == 1) { noteTriggers[2] = Message.getNoteNumber(); // currently this changes the mapping backend, but doesn't update combobox ButtonLearnNote1.setValue(0); // turns off the learn button ComboBoxKickMidi.setValue(Message.getNoteNumber()); // supposed to set the combobox, but it doesn't work }
I get an error on the combobox line.
Unknown function 'setValue'
How is it an "unknown function" if it works in the preceding line? The function exists in the API. What is going on here and how do I get it to change the value of the combobox?
Thank you.
-
@gorangrooves You have two calls to setValue(), which is giving the error?
-
@d-healey The one that sets the value for the combobox, the last line.
-
@gorangrooves Are you sure the variable name is correct?
-
@d-healey Yes. Ok. I got it.
It has the correct name, but while it had a callback on the main interface onInit, it didn't have the variable definition. So, it worked manually selecting notes, but not with this script.
Thank you, Dave. I crossed this bridge :)