This is the code in the example where I resized dial2. Why can’t I see dial2 in the interface?
class MainContentComponent : public juce::Component
{
public:
MainContentComponent()
{
dial1.setSliderStyle (juce::Slider::Rotary);
dial1.setTextBoxStyle (juce::Slider::NoTextBox, false, 0, 0);
addAndMakeVisible (dial1);
button1.setButtonText (“Button 1”);
addAndMakeVisible (button1);
dial2.setSliderStyle (juce::Slider::Rotary);
dial2.setTextBoxStyle (juce::Slider::NoTextBox, false, 0, 0);
addAndMakeVisible (dial2);
button2.setButtonText ("Button 2");
addAndMakeVisible (button2);
setSize (300, 200);
}
void paint (juce::Graphics& g) override
{
//g.fillAll (getLookAndFeel().findColour (juce::ResizableWindow::backgroundColourId));
}
void resized() override
{
auto border = 4;
auto area = getLocalBounds();
auto dialArea = area.removeFromTop (area.getHeight() / 2);
dial1.setBounds (dialArea.removeFromLeft (dialArea.getWidth() / 2).reduced (border));
dial2.setBounds(10, 70, 90, 20);
auto buttonHeight = 30;
button1.setBounds (area.removeFromTop (buttonHeight).reduced (border));
button2.setBounds (area.removeFromTop (buttonHeight).reduced (border));
}
private:
juce::Slider dial1;
juce::Slider dial2;
juce::TextButton button1;
juce::TextButton button2;
//==============================================================================
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainContentComponent)
};