Tooltip woes

Hi Jucers,

I’m struggling with my tool tips seemingly at random deciding to insert a white background behind my rounded rectangle fill.
corners
Any clues or pointers as to why that would be?

I’m also struggling to understand how to switch tooltips on and off dynamically. I read one forum post where @jules suggested to delete the TooltipWindow, but another saying best practice is to use a SharedResourcePointer to contain the TooltipWindow. In fact if I don’t use the SRP and manage the TooltipWindow through new/delete myself then this works, until I have more than a single instance open, at which point I get assertions about having multiple instances of TooltipWindow in existence.

Probably you’ve setOpaque (true) when it shouldn’t be opaque?

Please NEVER use new/delete manually. I’ve no idea what you’re doing wrong with the SRP but that’s definitely the best way to keep exactly one tooltipwindow alive

JUCE’s tooltip window is opaque by default which is why you’re seeing those white corners. We just modified that line in our copy of JUCE, and then use the TooltipWindow via SharedResourcePointer

Yikes, that’s hardly a sensible workflow! There’s no need to modify JUCE itself, you could just have declared a subclass of TooltipWindow that calls setOpaque (false) and use that in your SRP!

Good point. We had previously used subclasses for these small changes/additions, but we switched to maintaining our own JUCE fork after making some larger modifications to the library

It’s working fine to show the tooltips using SRP, but that’s where I don’t follow how I can switch the tooltips on and off dynamically. This the only other forum post on the matter : Switching tooltips on or off, which is why I’m a bit confused :slight_smile:

Thanks for the input though, I’ve called setOpaque(false) on my TooltipWindow and now have transparent corners :smiley:

Your SRP doesn’t have to point to a TooltipWindow directly, it could (and probably should) point to an object that contains one, e.g.

{
    TooltipHolder() { ...create default window.. }
    std::unique_ptr<TooltipWindow> tooltipWindow;
};

Then use SharedResourcePointer<TooltipHolder> everywhere, and you can turn it on/off globally by deleting/creating its window object

1 Like