How to define own tooltip text

User avatar
seal58
Posts: 351
Joined: Fri Jul 12, 2019 5:28 pm
Location: Rostock, Germany
Contact:

How to define own tooltip text

Post by seal58 »

I'd like to show the user of my module tool tips with explanation of function and possible input range. In VM Java docs I couldt only find GetTooltipText().
- Is there a hidden SetTooltipText() methode anywhere? :?:
- Or is there a way to modify Voltage tooltip texts?
- Or do I have to create temporarily existing VoltageLabels?

Roland
UrbanCyborg
Posts: 588
Joined: Mon Nov 15, 2021 9:23 pm

Re: How to define own tooltip text

Post by UrbanCyborg »

Well, you could trap the mouse for an object, then display a dialog box after a predefined delay. There's a CA function for a text box. I suspect that's how people like Andrew Macaulay and Chris Neuberger are doing their help displays, and it's the route I was about to go.

Reid
Cyberwerks Heavy Industries -- viewforum.php?f=76
User avatar
seal58
Posts: 351
Joined: Fri Jul 12, 2019 5:28 pm
Location: Rostock, Germany
Contact:

Re: How to define own tooltip text

Post by seal58 »

Hello Reid,
I was feared that this is the only way. (because I'm lazy ;) ) Ok, so I will do it that way.
Thx for your quick response.

Roland
UrbanCyborg
Posts: 588
Joined: Mon Nov 15, 2021 9:23 pm

Re: How to define own tooltip text

Post by UrbanCyborg »

No problemo. Just happened to be up.

Reid
Cyberwerks Heavy Industries -- viewforum.php?f=76
User avatar
seal58
Posts: 351
Joined: Fri Jul 12, 2019 5:28 pm
Location: Rostock, Germany
Contact:

Re: How to define own tooltip text

Post by seal58 »

Until now sence of GetTooltipText() is not clear to me yet. Explanation above that part in VMD project says:

"// public String GetTooltipText( VoltageComponent component )

// Gets called when a tooltip is about to display for a control. Override it if
// you want to change what the tooltip displays. ..."


How shall I override that text with a Get..Text() methode instead of Set...Text()?

Roland
ColinP
Posts: 939
Joined: Mon Aug 03, 2020 7:46 pm

Re: How to define own tooltip text

Post by ColinP »

Hi Roland,

If you want to override the default text then instead of returning super.GetTooltipText( component ) return the text you want for the given component. Here's a simple example...

Code: Select all


@Override
public String GetTooltipText( VoltageComponent component )
{
   // add your own code here

   if( component == lfoRateKnob )
      return lfoRateAsString();			// custom string

   return super.GetTooltipText( component );	// default string generated by VM
}
User avatar
seal58
Posts: 351
Joined: Fri Jul 12, 2019 5:28 pm
Location: Rostock, Germany
Contact:

Re: How to define own tooltip text

Post by seal58 »

Oh my! It's so eaysy - if you know it. :oops: But unfortunately it is nowhere explained in CA's Javadoc.
I thank you so much, Colin.

Meanwhile I created my own tooltip. It works fine on a test module. But at the moment text fields are cut at module border, while Voltage tip text fields even reach further than debugger window edge.

Nevertheless I checked Voltage tooltips for several controls and found that it does not work for labels, even when they are editible and marked with "Wants mouse notification". Is that normal behavior? If yes, I will have to use my selfmade tooltips.

Roland
User avatar
ChR_is
Posts: 106
Joined: Wed Sep 22, 2021 5:48 pm

Re: How to define own tooltip text

Post by ChR_is »

you can overlay text with invisible buttons and then use the invisible button as a tooltip proxy
UrbanCyborg
Posts: 588
Joined: Mon Nov 15, 2021 9:23 pm

Re: How to define own tooltip text

Post by UrbanCyborg »

Thanks for stepping in, Chris. Something like that is what I meant in my post, but maybe I didn't spell it out well enough. I hadn't tested it out yet, so I was kind of guessing. The idea of using a hidden control, or one that only shows when moused over as a tooltip generator, or to trigger a text box is something I'm working on right now. Thanks for confirming that it'll work.

Reid
Cyberwerks Heavy Industries -- viewforum.php?f=76
User avatar
seal58
Posts: 351
Joined: Fri Jul 12, 2019 5:28 pm
Location: Rostock, Germany
Contact:

Re: How to define own tooltip text

Post by seal58 »

Hello,

thanks for the idea with hidden control. I did some tests and found these facts:

- An invisible button never provides a TooltipText event.
- A button, that is visible, but hidden by a label provides a TooltipText event only, when the label options "Is Number Editor" AND "Wants Mouse Notification" are unchecked.

For my module I just need to use the labels with "Number Editor" options. So regular ToolTipText function seems not to be usable for me.

Roland
Post Reply

Return to “Module Designer”