Control the time a ToolTipText is displayed

If I have a small text everything is ok. But if I have a larger text it will disapear very quickly, so the user cant read it completly.

How can I control this ???

thats a system property, i see it defaults to 4 seconds.
And it will be application wide so you can never controll it for one tooltip. So if we would change the dismiss time then it would happen for all tooltips.

I would prefer 5 seconds instead of 4. A minor issue, but the extra second would help.

Johan, can you make adjustable as developer preference?

Did this ever make it into preferences? It would be handy.

Chiming in – my client just asked for this too…

Until Servoy adds this in, here’s a small plugin to control tooltips. Usage:

// retrieve/set tooltip initial delay (use milliseconds)
var x = plugins.tooltip.delay
plugins.tooltip.delay = 0

// retrieve/set tooltip time until dismiss (use milliseconds)
var y = plugins.tooltip.dismiss
plugins.tooltip.dismiss = 1000

tooltip.jar (2.97 KB)

This works great!

Hello,

Tooltip control via above plugin works well in Smart Client, but not in WebClient?

Is there any version that works for WebClient also? Where can I find it?
If not, how to implement extension for WebClient?

Regards

It’s not possible to control this currently in the Web Client.

Please file a feature request for this, so we can investigate this.

Paul

Tokajac:
Tooltip control via above plugin works well in Smart Client, but not in WebClient?

Is there any version that works for WebClient also? Where can I find it?
If not, how to implement extension for WebClient?

By default, browsers display the title attribute of a dom element as a tooltip. You can modify this default behavior with client-side javascript and almost all javascript libraries (jquery, prototype, YUI, etc) have libraries to do this – some very advanced.

Servoy also displays tooltips with client-side javascript but instead of writing out title attributes for elements and then manipulating the title attribute it writes out:

<div style="white-space:nowrap;" class="label" id="sv_46A5EE99_E1E7_495F_A887_F6965D53CE6E" onmouseover="showtip(event, 'Tooltip text here');" onmouseout="hidetip();" tabIndex="-1">Company</div>

The easiest hack then would be to override servoy’s client-side javascript functions that deal with the onmouseover and onmouseout events. Here’s the code Servoy uses:

<script type="text/javascript" ><![CDATA[/*>]]>*/</script>

Change the value of 5000 (which is milliseconds) to whatever value you want on this line:

tipTimeout = setTimeout("hidetip();", 5000);

Now you need to insert this code block into the output servoy generates after where Servoy is including the code – which would be in the header section. A web page will then call your functions instead of Servoy’s since they were loaded last.

This is actually quite easy to do by modifying the top level html template Servoy uses to generate all web client pages. It is called “MainPage.html” and it is only accessible via WebDav.

On a Mac (with Servoy open) > Finder app > “Go” menu item > “Connect to Server…” sub-menu item > enter “http://localhost:8080/servoy-webclient/templates/default/”.

Now open up “MainPage.html” in your favorite text editor. Paste in the slightly modified javascript block between the closing /body and closing /html tags.

Restart Servoy.

Disclaimer: this is a hack :) However, it’s easy to restore to Servoy’s default state. Just delete “MainPage.html” and Servoy will regenerate the original file.

Thanks, David - really great tips!

david:
Disclaimer: this is a hack :) However, it’s easy to restore to Servoy’s default state. Just delete “MainPage.html” and Servoy will regenerate the original file.

Great tip. Actually this is not a hack but exactly why the templates are editable.

Thank you for your solution David! Tested and it works

Further,
tooltips.jar plugin is based on: javax.swing.ToolTipManager
Thinking about integration of WebClient’s tooltip control to that plugin…
Incompleteness of WebDav idea is that Servoy has to be restarted for changes to take effect. Need to access programmatically to MainPage.html: can I update MainPage.html and announce the template changes immediately without restarting Servoy?

How to change the tooltips dynamically in WebClient like it’s currently possible in Smart Client via the plugin? That’s submitted as a feature request

Regards

You also use inline java code:

Packages.javax.swing.ToolTipManager.sharedInstance().setInitialDelay(<some_delay);
Packages.javax.swing.ToolTipManager.sharedInstance().setDismissDelay(<some_delay);

Regards,

Danny

danny.richadson:
You also use inline java code:

Packages.javax.swing.ToolTipManager.sharedInstance().setInitialDelay(<some_delay);
Packages.javax.swing.ToolTipManager.sharedInstance().setDismissDelay(<some_delay);

Regards,

Danny

Danny how about:

application.setUIProperty(APP_UI_PROPERTY.TOOLTIP_DISMISS_DELAY, 40000)
application.setUIProperty(APP_UI_PROPERTY.TOOLTIP_INITIAL_DELAY, 10)

Jan Aleman:

danny.richadson:
You also use inline java code:

Packages.javax.swing.ToolTipManager.sharedInstance().setInitialDelay(<some_delay);
Packages.javax.swing.ToolTipManager.sharedInstance().setDismissDelay(<some_delay);

Regards,

Danny

Danny how about:

application.setUIProperty(APP_UI_PROPERTY.TOOLTIP_DISMISS_DELAY, 40000)
application.setUIProperty(APP_UI_PROPERTY.TOOLTIP_INITIAL_DELAY, 10)

Jan,

When I try your sample I get the following error : Java class “com.servoy.j2db.scripting.info.UICONSTANTS” has no public instance field or method named “TOOLTIP_DISMISS_DELAY”

We are using Servoy 5.2.9

Regards,

Peter

It’s a 6.x feature

Ok, that explains it, until we migrate to Servoy 6 we will use Danny’s tip.

Regards