Tooltips garbled when moving fast


#1

Hi all,

Latest tip from today…

When I go over components with tooltips and I move “slow enough” from one component to the next all is fine.
However, when I move quickly, the tooltip-text from one component is overlaid on the tooltip-text of the next component.
I can reproduce this faithfully.

[attachment=0]tooltips-garbled.png[/attachment]

  • Bram

#2

Bizarre… I can’t any way it could possibly be drawn like that! I also can’t think why the speed would make any difference…


#3

Ah, found it: aparently tooltips should not have a (slightly) transparent background colour…
That’s a pitty…

Here is some code if you want to reproduce, just move from red to green a few times:

class MainContentComponent   : public Component
{
public:
    //==============================================================================
    MainContentComponent()
    {
        LookAndFeel::setDefaultLookAndFeel(&m_DefaultLookAndFeel);

        addAndMakeVisible(m_Label1 = new Label());
        m_Label1->setColour(Label::backgroundColourId,Colours::red);
        m_Label1->setTooltip("THIS IS A TOOLTIP");

        addAndMakeVisible(m_Label2 = new Label());
        m_Label2->setColour(Label::backgroundColourId,Colours::green);
        m_Label2->setTooltip("ALSO! THIS IS A TOOLTIP TOO!");

        setSize (500, 400);

    }

    ~MainContentComponent() {};

    void paint (Graphics&) {};

    void resized()
    {
        m_Label1->setBounds(0, 0, 100, 100);
        m_Label2->setBounds(0, 100, 100, 100);
    };

private:
    class DefaultLookAndFeel : public LookAndFeel
    {
    public:
        DefaultLookAndFeel()
        {
            setColour(TooltipWindow::backgroundColourId, Colours::black.withAlpha(0.1f));
            setColour(TooltipWindow::textColourId, Colours::white);
        }
    };

    ScopedPointer<Label> m_Label1;
    ScopedPointer<Label> m_Label2;
    TooltipWindow m_TooltipWindow;
    DefaultLookAndFeel m_DefaultLookAndFeel;

    //==============================================================================
    JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainContentComponent)
};

I guess something should be written somewhere about not using a transparent color as background, or it should be fixed in another way, I suppose.
It would be nice to be able to have half-transparent tooltip windows - but not very important I suppose.

  • bram

#4

In that case I’d have thought that if you call setOpaque (false) on your tip window, that’d work ok?


#5

hah! of course that works.
thx! :slight_smile:

  • bram