I’m just getting going with Juce and I’m using a valueTree to register parameters/GUI controls. The sliders are working great and updating as expected in both directions. I’ve implemented a comboBox in the same way and although it works both with automation and the GUI as expected, when the plug-in is first loaded the box is blank. So it seems that it isn’t getting initialized correctly and I’m hoping there is either something I’ve missed or a solution?
When you set your combo box default in your processor value tree state, what do you set it to? If I remember right, the combo box id starts from 1, but the processor value tree state value should still start from 0. Hope that makes sense!
Can you please make sure to add the options to the combobox before you attach the ComboBoxAttachment. The initial update happens, when the attachment is created, so if the combobox has no items, it can’t set it appropriately.
@JoshuaHodge is right, that is another issue, and the attachment seems a bit messy. The parameter updates the index, vs. the combobox sets the parameter to ID-1.0, so make sure to use the IDs 1 onwards…
Thank you both, Daniel hit the nail on the head, it’s working fine now! I was aware of the id starting at 1 and had done so.
One more question on the comboBox, seeing as the range is calculated across the 0.0 to 1.0 range to get the index it means that it will never be possible to add more items at a later stage without destroying backward compatibility. I was wondering if there was any way to work around that? At the moment I’m thinking I may have to use some reserved entries which is messy.