How to define own tooltip text
How to define own tooltip text
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
- 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
-
- Posts: 625
- Joined: Mon Nov 15, 2021 9:23 pm
Re: How to define own tooltip text
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
Reid
Cyberwerks Heavy Industries -- viewforum.php?f=76
Re: How to define own tooltip text
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
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
-
- Posts: 625
- Joined: Mon Nov 15, 2021 9:23 pm
Re: How to define own tooltip text
No problemo. Just happened to be up.
Reid
Reid
Cyberwerks Heavy Industries -- viewforum.php?f=76
Re: How to define own tooltip text
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
"// 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
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...
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
Oh my! It's so eaysy - if you know it. 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
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
you can overlay text with invisible buttons and then use the invisible button as a tooltip proxy
-
- Posts: 625
- Joined: Mon Nov 15, 2021 9:23 pm
Re: How to define own tooltip text
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
Reid
Cyberwerks Heavy Industries -- viewforum.php?f=76
Re: How to define own tooltip text
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
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