Hi everyone !
I am new to JUCE. I am trying to learn and as you may guessed i have some problems and questions . The code below includes 6 rotary sliders but unfortunately some them don’t work. Everything that i wrote is the same for all of them. Could you please check it and let me know what’s wrong with it ?
https://i.hizliresim.com/Z5PEOg.jpg
__________________________________________________________
#include "MainComponent.h"
//========================================================
MainComponent::MainComponent()
{
dial1.setSliderStyle (Slider::SliderStyle::Rotary);
dial1.setTextBoxStyle(Slider::TextBoxBelow, false, 50, 20);
dial2.setSliderStyle (Slider::SliderStyle::Rotary);
dial2.setTextBoxStyle(Slider::TextBoxBelow, false, 50, 20);
dial3.setSliderStyle (Slider::SliderStyle::Rotary);
dial3.setTextBoxStyle(Slider::TextBoxBelow, false, 50, 20);
dial4.setSliderStyle (Slider::SliderStyle::Rotary);
dial4.setTextBoxStyle(Slider::TextBoxBelow, false, 50, 20);
dial5.setSliderStyle (Slider::SliderStyle::Rotary);
dial5.setTextBoxStyle(Slider::TextBoxBelow, false, 50, 20);
dial6.setSliderStyle (Slider::SliderStyle::Rotary);
dial6.setTextBoxStyle(Slider::TextBoxBelow, false, 50, 20);
addAndMakeVisible(dial1); // this doesnt move
addAndMakeVisible(dial2); // this doesnt move
addAndMakeVisible(dial3);
addAndMakeVisible(dial4);
addAndMakeVisible(dial5); // this doesnt move
addAndMakeVisible(dial6);
setSize (600, 400);
}
MainComponent::~MainComponent()
{
}
//=============================================================
void MainComponent::paint (Graphics& g)
{
g.fillAll(Colours::darkgrey);
}
void MainComponent::resized()
{
Rectangle<int>
area = getLocalBounds();
Rectangle<int>
dialArea = area.removeFromBottom(area.getHeight() / 2);// we devided the area which has
//the same bound with the mainwindow
Rectangle<int> // then we set this area as bound for our
slider(dial1).
quarterdial = dialArea.removeFromRight(dialArea.getWidth() / 3);
dial1.setBounds(quarterdial);
area = getLocalBounds();
dialArea = area.removeFromTop(area.getHeight() / 2);
quarterdial = dialArea.removeFromRight(dialArea.getWidth() / 3);
dial2.setBounds(quarterdial);
area = getLocalBounds();
dialArea = area.removeFromTop(area.getHeight() / 2);
dial3.setBounds(area);
area = getLocalBounds();
dialArea = area.removeFromBottom(area.getHeight() / 2);
quarterdial = dialArea.removeFromLeft(dialArea.getWidth() / 3);
dial5.setBounds(quarterdial);
area = getLocalBounds();
dialArea = area.removeFromTop(area.getHeight() / 2);
quarterdial = dialArea.removeFromLeft(dialArea.getWidth() / 3);
dial4.setBounds(quarterdial);
area = getLocalBounds();
dialArea = area.removeFromBottom(area.getHeight() / 2);
dial6.setBounds(area);
}
_________________________________________________________