Trying to set look and feel on slider tooltip windows

gui

#1

I’m trying to set the look and feel of the tool tip window on a slider by overriding the drawTooltip function but it doesn’t appear to be working for me. I’m problem missing something silly but what?

My look and feel class:

class TestLAF : public LookAndFeel_V2
{
public:
    TestLAF() {}
    ~TestLAF() {}

    void drawTooltip(Graphics&g, const String& text, int width, int height) override
    {
        //Just making the window bright magenta for now
        g.fillAll(Colours::magenta);
    }
};

Setting my look and feel class in the juce demo which I’ve edited to add example tooltips to all sliders:

    TestLAF* tlaf = new TestLAF();
    addLookAndFeel(tlaf, "Test Look and Feel");
    setupTestLookAndFeelColours(*tlaf);

The result is still the default tooltip look
Untitled


#2

https://docs.juce.com/master/classComponent.html#a6f2c10cd9840844a5be16e5deeef6f50

Component::setLookAndFeel()

Rail


#3

Thank you for your reply, it looks like the juce demo is already using setLookAndFeel however. These are called when I select my look and feel class from the list

void setAllLookAndFeels (LookAndFeel* laf)
{
    for (int i = 0; i < demoComp.getNumChildComponents(); ++i)
        if (Component* c = demoComp.getChildComponent (i))
            c->setLookAndFeel (laf);
}

void comboBoxChanged (ComboBox* comboBoxThatHasChanged) override
{
    if (comboBoxThatHasChanged == &lafBox)
        setAllLookAndFeels (lookAndFeels[lafBox.getSelectedItemIndex()]);
}

#4

I’d look at the scope and lifetime of

TestLAF* talk

Rail