I’ve noticed that several JUCE apps (including Tracktion) have a sort of status bar that displays little text hints, or prompts… ie. "Click to select this track; double-click to expand it."
In Tracktion, this is separate from the actual ‘Tooltip’ mechanism – as those are floating windows that can be turned on and off.
Is there a built in component mechanism getting used here, or am I missing something obvious?
I was thinking I could build an interface that all my widgets implement, allowing me to watch all of them with a MouseListener, etc…
But, it seems there might be a simpler way that I’m just overlooking…
Those are just done as custom components, but will still use the normal ToolTipClient class. It’s quite easy, just have a timer that finds the component under the mouse, and tries to cast it to a ToolTipClient. If it is one, you display its tip. There’s code inside ToolTipWindow that you can pretty much copy out to do that for you.
TBH a comp to do this might be a nice little addition. I’ll do one if I get chance.
If the component under the mouse is a tooltipclient, wouldn’t the status bar text and the actual floating tooltip window both display the same text, then?
Whereas, the status bar text is brief and the floating window is verbose…
I guess two custom tooltip ‘displayers’ could be in use, both parsing out the appropriate bit of string from the getTooptip()… hmm.
Can’t remember, to be honest!
I’d be eager to use such addition (tooltip text component for use as a statusbar tooltip), if you have some ready-to-use code, could you please add this to the repository. Otherwise here’s my implementation, as a subclass of Label:
Feel free to use this code.