drawRotarySlider() is the function I need to override for Slider - for TextButton is it drawButtonBackground()?

For a custom lookAndFeel the drawRotarySlider() function is overridden to implement my own custom laf.
Thats for a slider.

I also have a TextButton.
Do I have to override drawButtonBackground() and drawButtonText() to create my custom laf for TextButton objects ?

Yes. You can view the available LookAndFeel methods in the JUCE Class documentation, i.e.:

https://docs.juce.com/master/structButton_1_1LookAndFeelMethods.html

1 Like

thanks for the link. :+1:
So, those two functions drawButtonBackground() and drawButtonText() are the relevant ones. Thanks.

You can also just implement Button::paintButton.

1 Like

Can anyone give me insight into some errors I’m getting here? I tried to create my own custom class for TextButton so I can make a toggle button.

class myCustomToggleButton : public juce::LookAndFeel_V4
{
public:
    void drawButtonBackground(juce::Graphics& g, juce::Button& button, const juce::Colour& backgroundColour,
        bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown) override
    {
        
    }

    void drawButtonText(juce::Graphics& g, juce::TextButton& button, bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown) override
    {
        
    }
};

I tried class myCustomToggleButton : public juce::TextButton but it didn’t recognize the drawButtonText() etc…

PluginEditor.h:
myCustomToggleButton blueToggleButton;

PluginEditor.cpp:
constructor

blueToggleButton("Blue Toggle Button"),
    mBlueToggleButton_buttonAttachment(audioProcessor.apvts, "blueToggleButtonParameterID", blueToggleButton),

This gives me an error Severity Code Description Project File Line Suppression State
Error (active) E0289 no instance of constructor “myCustomToggleButton::myCustomToggleButton” matches the argument list

Same for the next line buttonattachment too.

If I understand correctly, you need to assign the custom LookAndFeel to an instance of the TextButton; not derive from it.

Keep the first part; that is your custom LookAndFeel.

PluginEditor.h:
myCustomToggleButton customLAF;
TextButton blueToggleButton ;

Constructor:
addAndMakeVisible(blueToggleButton);
blueToggleButton.setLookAndFeel(&customLAF);
1 Like

Yes(!), that seems to have got rid of the errors. It makes sense.
Now I have to add some raster images for on/off, and test it out. thanks