Customizing Slider Inc/Dec buttons?

Is it possible to customize the drawing of the inc/dec buttons? I’m been asked to change the colors for those in our software, but I don’t see how to do that without affecting the colors for other buttons as well. Changing various colors listed in Projucer didn’t seem to help. And they do not appear to be named objects, but rather internally-created objects within the Slider class, so I don’t see how I could use Look&Feel to modify them. I was thinking that maybe if I asked for the parent of the parent of each button, if it was the particular component that contained these sliders, then I could customize the drawing, but I’m wondering if there is an easier, more direct way to modify their colors?

Also, is there a way to prevent the inc/dec buttons from being part of the tabbing order? When I tab through my component that has these sliders, I have to hit Tab three times to get to the next slider’s editor. I assume this is because the inc/dec buttons are each accepting focus, so the tab order goes: slider’s editor, dec button, inc button, next slider’s editor, etc. Can this behavior be changed?

[IGNORE THIS COMMENT - see below] Strangely, even if I set the LookAndFeel for the parent component (a tab in a TabbedComponent), and its parent component (the TabbedComponent), and its parent component (a main view in our plugin), when the buttons go to draw, they still use the LookAndFeel_V4 class, not our class! So I can’t customize that behavior at ll, because our code is never called.

[This turned out to be because that code was in a #if block that was not for this project. In Visual Studio, it would have been greyed out so I would have known it was inactive code. Not the case in Xcode.]

struct YourSliderLookAndFeel : public YourAppLookAndFeel
{
    void drawButtonBackground (Graphics& g, Button&, const Colour&, bool, bool) override
    {
        g.fillAll (Colours::yellow);
    }
};

YourSliderLookAndFeel lf;

yourSlider.setLookAndFeel (&lf);
1 Like