So I’m almost there I think. But I’m not seeing the sliders only after I resize. Is there a way I can trigger this so I can put all the bounds information is resize?
this is in my MainComponent.cpp:
/*
This file was auto-generated!
==============================================================================
*/
#include “MainComponent.h”
//==============================================================================
MainComponent::MainComponent()
{
setSize (600, 400);
// in the constructor of your editor class
for (int i=0;i<3;++i)
{
Slider* slider = new Slider;
addAndMakeVisible(slider);
// whatever else initialization you need for the slider...
mySliders.add(slider);
}
}
MainComponent::~MainComponent()
{
}
//==============================================================================
void MainComponent::paint (Graphics& g)
{
}
void MainComponent::resized()
{
for (int i=0;i<mySliders.size();++i)
{
mySliders[i]->setBounds(100, i*100, 100, 20);
}
}
and this in my MainComponent.h file:
#pragma once
#include “…/JuceLibraryCode/JuceHeader.h”
//==============================================================================
/*
This component lives inside our window, and this is where you should put all
your controls and content.
*/
class MainComponent : public Component
{
public :
//==============================================================================
MainComponent();
~MainComponent();
//==============================================================================
void paint (Graphics&) override ;
void resized() override ;
private :
//==============================================================================
// Your private member variables go here…
// as a member variable of your editor class
OwnedArray mySliders;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainComponent)
};
Am I missing something?
The sliders will only show up after I resize…