5

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

Is this possible to achieve?

Reddy
  • 8,737
  • 11
  • 55
  • 73

2 Answers2

10

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
  • 9,285
  • 5
  • 49
  • 82
  • For this we have to add event handlers for every widget ..right? – Reddy Jun 24 '10 at 12:54
  • 2
    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 Jun 24 '10 at 15:37
  • an alternative using css: http://stackoverflow.com/questions/5641304/tooltips-for-gwt-tree-adding-mouseovers-to-nodes/18058618#18058618 – Brimstedt Aug 05 '13 at 12:51
1

setTitle worked for me if I included a \n as a line separator.

Druid
  • 6,423
  • 4
  • 41
  • 56
Eric Woodruff
  • 6,380
  • 3
  • 36
  • 33
  • Which component are you using in your tooltip panel. Try using a text area in your tooltip: you will be able to \n your text regardless of the GWT version. – Christian Achilli Oct 11 '12 at 13:19