# Control the time a ToolTipText is displayed

**URL:** <https://forum.servoy.com/t/control-the-time-a-tooltiptext-is-displayed/3551>\
**Category:** Classic Servoy\
**Created:** [January 27, 2005, 10:58am UTC](https://forum.servoy.com/t/control-the-time-a-tooltiptext-is-displayed/3551 "2005-01-27T10:58:10Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![elmono\_acosta](https://avatars.discourse-cdn.com/v4/letter/e/b9e5f3/32.png) [@elmono\_acosta](https://forum.servoy.com/u/elmono_acosta)\
**Post date:** [January 27, 2005, 10:58am UTC](https://forum.servoy.com/t/control-the-time-a-tooltiptext-is-displayed/3551/1 "2005-01-27T10:58:10Z")

</div>

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 ???

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [January 31, 2005, 2:48pm UTC](https://forum.servoy.com/t/control-the-time-a-tooltiptext-is-displayed/3551/2 "2005-01-31T14:48:57Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Westy](https://avatars.discourse-cdn.com/v4/letter/w/9de053/32.png) [@Westy](https://forum.servoy.com/u/Westy)\
**Post date:** [February 2, 2005, 4:33am UTC](https://forum.servoy.com/t/control-the-time-a-tooltiptext-is-displayed/3551/3 "2005-02-02T04:33:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Harjo](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/harjo/32/4873_2.png) [@Harjo](https://forum.servoy.com/u/Harjo)\
**Post date:** [February 2, 2005, 7:50am UTC](https://forum.servoy.com/t/control-the-time-a-tooltiptext-is-displayed/3551/4 "2005-02-02T07:50:18Z")

</div>

Johan, can you make adjustable as developer preference?

---

<div class="post-metadata">

**Author:** ![yekinabud](https://avatars.discourse-cdn.com/v4/letter/y/258eb7/32.png) [@yekinabud](https://forum.servoy.com/u/yekinabud)\
**Post date:** [December 25, 2007, 1:05am UTC](https://forum.servoy.com/t/control-the-time-a-tooltiptext-is-displayed/3551/5 "2007-12-25T01:05:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ellenmeserow](https://avatars.discourse-cdn.com/v4/letter/e/cdc98d/32.png) [@ellenmeserow](https://forum.servoy.com/u/ellenmeserow)\
**Post date:** [March 3, 2008, 8:37pm UTC](https://forum.servoy.com/t/control-the-time-a-tooltiptext-is-displayed/3551/6 "2008-03-03T20:37:22Z")

</div>

Chiming in – my client just asked for this too…

---

<div class="post-metadata">

**Author:** ![david](https://avatars.discourse-cdn.com/v4/letter/d/aeb1de/32.png) [@david](https://forum.servoy.com/u/david)\
**Post date:** [March 4, 2008, 2:03pm UTC](https://forum.servoy.com/t/control-the-time-a-tooltiptext-is-displayed/3551/7 "2008-03-04T14:03:07Z")

</div>

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

```auto
// 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](https://forum.servoy.com/uploads/short-url/ciqIvGCKbFJOHZLhh8GIXAIXdGl.jar) (2.97 KB)

---

<div class="post-metadata">

**Author:** ![ellenmeserow](https://avatars.discourse-cdn.com/v4/letter/e/cdc98d/32.png) [@ellenmeserow](https://forum.servoy.com/u/ellenmeserow)\
**Post date:** [March 10, 2008, 11:40pm UTC](https://forum.servoy.com/t/control-the-time-a-tooltiptext-is-displayed/3551/8 "2008-03-10T23:40:49Z")

</div>

This works great!

---

<div class="post-metadata">

**Author:** ![Tokajac](https://avatars.discourse-cdn.com/v4/letter/t/838e76/32.png) [@Tokajac](https://forum.servoy.com/u/Tokajac)\
**Post date:** [April 4, 2011, 3:12pm UTC](https://forum.servoy.com/t/control-the-time-a-tooltiptext-is-displayed/3551/9 "2011-04-04T15:12:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pbakker](https://avatars.discourse-cdn.com/v4/letter/p/a4c791/32.png) [@pbakker](https://forum.servoy.com/u/pbakker)\
**Post date:** [April 4, 2011, 3:43pm UTC](https://forum.servoy.com/t/control-the-time-a-tooltiptext-is-displayed/3551/10 "2011-04-04T15:43:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![david](https://avatars.discourse-cdn.com/v4/letter/d/aeb1de/32.png) [@david](https://forum.servoy.com/u/david)\
**Post date:** [April 4, 2011, 8:52pm UTC](https://forum.servoy.com/t/control-the-time-a-tooltiptext-is-displayed/3551/11 "2011-04-04T20:52:17Z")

</div>

> 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:

```auto
<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:

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

```

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

```auto
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/](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 ![:)]( "Smile") However, it’s easy to restore to Servoy’s default state. Just delete “MainPage.html” and Servoy will regenerate the original file.

---

<div class="post-metadata">

**Author:** ![bobcusick](https://avatars.discourse-cdn.com/v4/letter/b/ba9def/32.png) [@bobcusick](https://forum.servoy.com/u/bobcusick)\
**Post date:** [April 6, 2011, 5:59pm UTC](https://forum.servoy.com/t/control-the-time-a-tooltiptext-is-displayed/3551/12 "2011-04-06T17:59:47Z")

</div>

Thanks, David - really great tips!

---

<div class="post-metadata">

**Author:** ![Jan\_Aleman](https://avatars.discourse-cdn.com/v4/letter/j/4af34b/32.png) [@Jan\_Aleman](https://forum.servoy.com/u/Jan_Aleman)\
**Post date:** [April 6, 2011, 8:26pm UTC](https://forum.servoy.com/t/control-the-time-a-tooltiptext-is-displayed/3551/13 "2011-04-06T20:26:11Z")

</div>

> david:  
> Disclaimer: this is a hack ![:)]( "Smile") 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.

---

<div class="post-metadata">

**Author:** ![Tokajac](https://avatars.discourse-cdn.com/v4/letter/t/838e76/32.png) [@Tokajac](https://forum.servoy.com/u/Tokajac)\
**Post date:** [April 7, 2011, 3:10pm UTC](https://forum.servoy.com/t/control-the-time-a-tooltiptext-is-displayed/3551/14 "2011-04-07T15:10:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![danny.richadson](https://avatars.discourse-cdn.com/v4/letter/d/6f9a4e/32.png) [@danny.richadson](https://forum.servoy.com/u/danny.richadson)\
**Post date:** [December 6, 2011, 12:19pm UTC](https://forum.servoy.com/t/control-the-time-a-tooltiptext-is-displayed/3551/15 "2011-12-06T12:19:10Z")

</div>

You also use inline java code:

Packages.javax.swing.ToolTipManager.sharedInstance().setInitialDelay(\<some\_delay);  
Packages.javax.swing.ToolTipManager.sharedInstance().setDismissDelay(\<some\_delay);

Regards,

Danny

---

<div class="post-metadata">

**Author:** ![Jan\_Aleman](https://avatars.discourse-cdn.com/v4/letter/j/4af34b/32.png) [@Jan\_Aleman](https://forum.servoy.com/u/Jan_Aleman)\
**Post date:** [December 6, 2011, 4:48pm UTC](https://forum.servoy.com/t/control-the-time-a-tooltiptext-is-displayed/3551/16 "2011-12-06T16:48:21Z")

</div>

> 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)

---

<div class="post-metadata">

**Author:** ![Peter\_de\_Groot](https://avatars.discourse-cdn.com/v4/letter/p/b4bc9f/32.png) [@Peter\_de\_Groot](https://forum.servoy.com/u/Peter_de_Groot)\
**Post date:** [December 7, 2011, 7:25am UTC](https://forum.servoy.com/t/control-the-time-a-tooltiptext-is-displayed/3551/17 "2011-12-07T07:25:06Z")

</div>

> 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

---

<div class="post-metadata">

**Author:** ![Jan\_Aleman](https://avatars.discourse-cdn.com/v4/letter/j/4af34b/32.png) [@Jan\_Aleman](https://forum.servoy.com/u/Jan_Aleman)\
**Post date:** [December 7, 2011, 7:28am UTC](https://forum.servoy.com/t/control-the-time-a-tooltiptext-is-displayed/3551/18 "2011-12-07T07:28:17Z")

</div>

It’s a 6.x feature

---

<div class="post-metadata">

**Author:** ![Peter\_de\_Groot](https://avatars.discourse-cdn.com/v4/letter/p/b4bc9f/32.png) [@Peter\_de\_Groot](https://forum.servoy.com/u/Peter_de_Groot)\
**Post date:** [December 7, 2011, 7:31am UTC](https://forum.servoy.com/t/control-the-time-a-tooltiptext-is-displayed/3551/19 "2011-12-07T07:31:50Z")

</div>

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

Regards
