Slider missing


Hey all,

I feel very stupid asking these questions but I can’t see my mistakes. I am new to Juce, my C++ is rusty, and trying to create a simple gain app on my own (recipe for disaster? maybe). I’ve been comparing my code to the JuceDemo and it all “appears” to be similar. However, when I load the plugin into a host prog, all that is displayed is whatever is in the paint() function which is just a background colour right now.

No slider to be found :frowning:
I used the function : addAndMakeVisible() and nothing is showing up. Is there anything else I should be using to make this visible? I was thinking maybe its under the background somehow?

Problem #2:
I also was having compile problems with this constructor to begin with. The only way this is compiling is if I have the constructor with one param (TestGainAudioProcessor*) which isn’t used in this constructor at all. If I make it a default constructor (zero params) and leave the implementation as follows (minus the param in the brackets and the AudioProcessorEditor constructor call), then I get a compile error = error C2512: ‘juce::AudioProcessorEditor’ : no appropriate default constructor available. Right now to me this seems like a shotty way of getting my project to compile. If anyone may know why I can’t override the default constructor without a problem that would be cool.

[code]TestGainAudioProcessorEditor::TestGainAudioProcessorEditor(TestGainAudioProcessor* ownerFilter)
: AudioProcessorEditor (ownerFilter),

addAndMakeVisible (&gainSlider);
gainSlider.setExplicitFocusOrder (2);
gainSlider.setRange (0, 10, 0);
gainSlider.setSliderStyle (Slider::LinearVertical);
gainSlider.setTextBoxStyle (Slider::TextBoxAbove, true, 0, 0);
gainSlider.setColour (Slider::backgroundColourId, Colour (0xa16262));
gainSlider.setColour (Slider::thumbColourId, Colour (0xff242445));
gainSlider.setColour (Slider::trackColourId, Colour (0x7f724a4a));
gainSlider.setColour (Slider::rotarySliderFillColourId, Colour (0x7f4f4fd3));
gainSlider.setColour (Slider::rotarySliderOutlineColourId, Colour (0x70030b41));
gainSlider.setColour (Slider::textBoxBackgroundColourId, Colour (0xff36709c));
gainSlider.setColour (Slider::textBoxHighlightColourId, Colour (0x406969e6));
gainSlider.setColour (Slider::textBoxOutlineColourId, Colour (0xb236129c));
gainSlider.addListener (this);

addAndMakeVisible (&gainLabel);
gainLabel.setFont (Font ("Cambria", 20.0000f, Font::plain));
gainLabel.setJustificationType (Justification::centredTop);
gainLabel.setEditable (false, false, false);
gainLabel.setColour (Label::textColourId, Colour (0xfff5f0f0));
gainLabel.setColour (TextEditor::textColourId, Colours::black);
gainLabel.setColour (TextEditor::backgroundColourId, Colour (0x0));
gainLabel.setColour (TextEditor::highlightColourId, Colour (0x40d0d0da));

setSize (150, 290);


    setSize (150,300);

//add slider
gainSlider.setRange(0.0, 1.0, 0.01);
gainSlider.setVelocityModeParameters(1,1,0.0, false);
addAndMakeVisible(&gainSlider, 1);
//add labels for sliders
gainLabel.attachToComponent(&gainSlider, false);



I hope I’ve provided enough information. If someone could show me what I’m doing wrong (or not doing at all) that’d be great!


You don’t seem to be giving your slider a size or position…


I was looking in the Slider class and Graphics class for something like that earlier. Didn’t even think about the functions it had by inheritance.
I am a little rusty :frowning: Sorry!

Thanks again! I appreciate it!


Try using the jucer to make some controls, then you can see what it does. Since it generates C++, you don’t need to use the result, you can just copy it or learn from it. Likewise, the jucedemo app.