ChoicePropertyComponent bug

At some point in version 6 our ChoicePropertyComponents which are connected via ValueObjects to our apps configuration stopped working.

It’s a complete maze of Value objects and every time I try a different version takes several minutes to rebuild the app. So it’s tricky to work out what’s going on.

The problem seems to arise when the Value object is originally an empty string, which isn’t a choice. It then seems impossible to get it to set the Value to any valid selection when using the UI.

Checking out the version of juce_ChoicePropertyComponent.* from version 6.0.1 restores the correct behaviour.

There have only been a couple of changes to the ChoicePropertyComponent since 6.0.1:

Could you try building your project with each of these versions of the ChoicePropertyComponent and find which version introduces the issue? If you’re able to provide a very minimal example project which demonstrates the problem that would also help us to track the bug down.

I’m thinking you’d want a bug demo app - but it’s a lot of typing :).

I’ll see if I can delegate the job :slight_smile:

The Projucer uses ChoicePropertyComponents. Both of the ChoicePropertyComponent changes above were made to fix issues that were affecting the Projucer. Perhaps you could try reproducing your issue in the Projucer to save you some typing.

Yeah - good plan mate. Gimme a sec - i’ll make a new clone of juce and have a poke… my suspicion is that it’s type/var related…

Right, found some time this evening:

class MainComponent : public juce::Component, public Value::Listener
        setSize (400, 200);
        addAndMakeVisible (panel);

        // with this line in place and JUCE 6.0.8 the listener is never called when the user changes the combo box
        v = String();

        // but with this next line enabled it will work
        // v = 0;

        Array<PropertyComponent*> properties;
        properties.add (new ChoicePropertyComponent (v, "Property", { "A", "B" }, { 0, 1 }));
        panel.addProperties (properties);

    void valueChanged(Value &) override
        DBG("working: value is now " + v.getValue().toString());

    ~MainComponent() override = default;

    void paint (juce::Graphics& g) override { g.fillAll (Colours::black); }

    void resized() override { panel.setBounds (getLocalBounds()); }

    Value v;
    PropertyPanel panel;


Looks like this was broken in 8fe3d297. I’ve pushed a fix to the develop branch here:

1 Like