Changing ComboBox items with buttons
-
Hi all,
I would like to change the item selected in a combobox using two increment/decrement buttons, but I can't figure out how to do this simple operation. What I have in mind is having the combobox as a samplemap selector and the two buttons acting as +1/-1 to change the samplemap.
Any clues?
Thanks a lot! -
ComboBox.setValue(ComboBox.getValue() + 1); ComboBox.setValue(ComboBox.getValue() - 1);
-
@alepan In your button callbacks, place:
if (myCb.getValue() < max){ // or > 1 (1, because 0 is nothing selected) myCb.setValue(myCb.getValue() + 1); // or -1 myCb.changed(); }
Note that you also need to add a security check for the Min/Max case
-
@d-healey we cross posted :)
-
Thanks a lot guys!
-
@ustk said in Changing ComboBox items with buttons:
if (myCb.getValue() < max){ // or > 1 (1, because 0 is nothing selected)
myCb.setValue(myCb.getValue() + 1); // or -1 myCb.changed();
}
Ok, button 1 acts as "-", button 2 should act as "+", but what I get is button 1 acting ok, and button 2 doing nothing...
what am I doing wrong?HiseSnippet 1008.3ocuW0uaaaCDmx1pqVctnEnO.B4ujwZCj5Wa.ooyyNIaFaI0XtKX+WAsDcLWjHEjn5hQPdl1qzdD1av1c5amp3lHrMEf.x6teGuu3wyyhjtr3XYDQq+6WGxHZeo970B0pIqnbAY5ADsGpeLMVwhLyHMdcHMNl4Qzz598HAs98Hoe+02Nl5SEtrJRDxoRtK6m3AbUE0Yi9Qtu+QTO164A0j9kil5JESj9xDvd5paSBotmSOicBEEqiNQ6dG5wUxn4JphECxLV5sd9J4uKxj+TdLegOC23PlCJJiLYxJtu2rBeMlPz5Mqxy6l44OQ+XtGujdUD3QoLLqPTOFn0YSSp2FljyMYRGI88PEbClmVMyqWl48X84tQ7PUEGz1df9TAjbVRgvdcyJSVRm+nm9DIHgPsa.8b1QQvlRDVu119olux1d3dCLFX.A+Xk4GoPpVFrPNVdgi49lEvOio.xgRArwZmRI1AwVg7XtHI9FQkx8ZHl4uE.HycxrN7OtvmKXlKSDtJtTXJEoZDwFI8sbK.9TPy9IrgCLtbfQe9RSqR6EOfSQlVCMeqY.WL7RS3yv.+ekTw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HDEZLn1nwcKr4krxn1+8Uip2Mh5MuoDtuV5mFPUqeIN9xkbCPa8Z2Vh2HJR3pkU6NtWtY+tR2GaNgq7VTOeaTCegdo6a9l+NoNlGOeNySUR1Vlm7G2+OJh7axTEWb9XpJli8tmlFNEd1nGCXhPvBvQOPCABUK6hxXkYJS3qE9O3K2XOT1H2XuUFIgTuX467xNZiuD6y0Z.NIzOHsM7xXP1tXZhoo69tjP3AhuyyCKEOG3d8XdwNf4fc.yK2ALuZGv75c.yWuCX9lshAea9OlpjgYGS.ESNVOb0v3XAE5xzcjj+GfyaRX4
-
@d-healey :)
-
You guys are faster than light :)
Thanks!! -
@alepan The issues were:
- Buttons were not set to momentary
- You did kind of the same thing twice in the callbacks
- Min and Max were not defined
-
@ustk Thanks, now I understand :)