tags:

views:

69

answers:

2

I need to show tool tip text in multiple lines, but setTitle() method in GWT is simply ignoring the '\n' character?

Is this possible to achieve?

A: 

You should use a line break,

<br />
Evan Trimboli
lblName.setTitle("First"+"<br/>"+"second") not working, at least in hosted mode.
Reddy
+5  A: 

If you are using the title property then it is not possible to have multi line tooltip. This is not a GWT problem, but a browser tooltip implementation/handling issue. If you really need to have a multi line tooltip then use Popup panel or DecoratedPopupPanel.

This will involve a little extra coding than just making a call to setTitle, but as a benefit you get complete control over how the tooltip is presented.

Ashwin Prabhu
Thanks Ashwin, will try it.
Reddy
For this we have to add event handlers for every widget ..right?
Reddy
Yes! Once to show and once again to hide the tooltip, ie. if you are not using autohide. You can use Mouse[Over/Out]Handler for this. Sounds like a lot of work :) But, If like me, you subclass input Widgets in your project and use these subclasses instead of GWT input widgets directly, then you can work out an elegant one time solution.
Ashwin Prabhu
Thanks Ashwin, we did the same. It is good now. :)
Reddy