I would like to add an extra label to a slider and create a custom component.
I have a custom rotary slider that works just fine. However, when I added the “resized” override to the custom class, my custom slider was no longer visible.
What’s stranger is that if I blindly drag the mouse over the area where the slider would have been, I notice that the values are being updated properly.
class customSlider : public juce::Slider
{
public:
customSlider() :
Slider{ juce::Slider::SliderStyle::RotaryHorizontalVerticalDrag,juce::Slider::TextBoxBelow}
{
addAndMakeVisible(myExtraLabel);
}
void resized() override
{
myExtraLabel.setBounds(...);
}
private:
juce::Label myExtraLabel;
};
If I were to remove this “resized” override, my slider reappears.
class mainBranch() : public juce::Component
{
public:
mainBrainch()
{
addAndMakeVisible(myCustomSlider);
}
void resized() override
{
myCustomSlider.setBounds(...);
}
private:
customSlider myCustomSlider;
};
FYI: I can add a label outside of my custom class and get the visual result I’d like, but I would like this to be encapsulated in a single class; thereby creating my own component.