Page 1 of 2

How to define own tooltip text

Posted: Sat Jan 28, 2023 7:08 pm
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

Re: How to define own tooltip text

Posted: Sun Jan 29, 2023 8:03 am
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

Re: How to define own tooltip text

Posted: Sun Jan 29, 2023 9:39 am
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

Re: How to define own tooltip text

Posted: Sun Jan 29, 2023 11:02 am
by UrbanCyborg
No problemo. Just happened to be up.

Reid

Re: How to define own tooltip text

Posted: Sun Jan 29, 2023 11:44 am
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

Re: How to define own tooltip text

Posted: Sun Jan 29, 2023 12:16 pm
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
}

Re: How to define own tooltip text

Posted: Sun Jan 29, 2023 7:47 pm
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

Re: How to define own tooltip text

Posted: Sun Jan 29, 2023 10:50 pm
by ChR_is
you can overlay text with invisible buttons and then use the invisible button as a tooltip proxy

Re: How to define own tooltip text

Posted: Mon Jan 30, 2023 1:45 am
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

Re: How to define own tooltip text

Posted: Mon Jan 30, 2023 10:08 am
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