Access Array in PluginEditor.h

Hi guys,

I am trying to access the effectDisplay array from a childComponent.

/**
*/
class ComponentTestAudioProcessorEditor  : public AudioProcessorEditor, private Slider::Listener
{
public:
    ComponentTestAudioProcessorEditor (ComponentTestAudioProcessor&);
    ~ComponentTestAudioProcessorEditor();

    //==============================================================================
    void paint (Graphics&) override;
    void resized() override;
    String effectDisplay[1][1] = {
        {"inactive"}};

private:
    // This reference is provided as a quick way for your editor to
    // access the processor object that created it.
    ComponentTestAudioProcessor& processor;
    SceneComponent scene;
    void sliderValueChanged (Slider* slider) override;
    


    JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ComponentTestAudioProcessorEditor)
};

All my attempts so far have been fruitlessā€¦
I am looking fo rsomething like _parent.effectDisplay[0][0];
but that doe snot work obviously :wink:

Any help is greatly appreciated, I am at 99% of my finished plugin, decided it would be nice to put more stuff in classes and now im stuckā€¦

Firstly, why are you declaring a 2D array with only 1 row and 1 column? You might as well just use a single String:

String effectDisplay = "inactive";

Then, so long as you have access to the PluginEditor instance in your child classes you will be able to call _parent.effectDisplay.

However, public members are almost always not a good idea. Getters and setters are much better!

1 Like

Hi,

I trimmed my array for display/forum purposes :wink:

I will investigate getter/setter!

thanks!