Browse Source

ChoicePropertyComponent: Ensure that ComboBox is always initialised with underlying Value object

v6.1.6
ed 3 years ago
parent
commit
51355b03df
1 changed files with 5 additions and 5 deletions
  1. +5
    -5
      modules/juce_gui_basics/properties/juce_ChoicePropertyComponent.cpp

+ 5
- 5
modules/juce_gui_basics/properties/juce_ChoicePropertyComponent.cpp View File

@@ -209,11 +209,9 @@ ChoicePropertyComponent::~ChoicePropertyComponent()
void ChoicePropertyComponent::initialiseComboBox (const Value& v)
{
if (v != Value())
{
comboBox.setSelectedId (v.getValue(), dontSendNotification);
comboBox.getSelectedIdAsValue().referTo (v);
}
comboBox.getSelectedIdAsValue().referTo (v);
comboBox.setEditableText (false);
addAndMakeVisible (comboBox);
}
@@ -222,10 +220,12 @@ void ChoicePropertyComponent::refreshChoices()
{
comboBox.clear();
for (auto choice : choices)
for (int i = 0; i < choices.size(); ++i)
{
const auto& choice = choices[i];
if (choice.isNotEmpty())
comboBox.addItem (choice, choices.indexOf (choice) + 1);
comboBox.addItem (choice, i + 1);
else
comboBox.addSeparator();
}


Loading…
Cancel
Save