No announcement yet.
  • Filter
  • Time
Clear All
new posts

    How to set the width of Tooltip as per the content?

    1. Smart GWT version: v9.0p_2013-07-29/PowerEdition Deployment (built 2013-07-29)
    2. GWT version: 2.5.0
    Problem statement:-

    Tooltip width should be set according to the text.
    By default it is 100 px. I want to set maximum 200 px and minimum as per content basis. Is it possible via built-in functions or CSS.
    Thank you

    There isn't a simple setting to achieve exactly what you're describing.

    The tooltips shown throughout the SmartGWT framework (for example the text shown in a hover when you specify a prompt on a Canvas) are rendered in a subclass of Canvas and standard sizing rules for an overflow:"visible" canvas apply.

    This means the tooltip will expand to accomodate its content, but as per standard HTML, text will wrap at the specified width if possible.

    You could modify your prompt to disable wrapping - this would cause the tooltip window to expand horizontally to accomodate the long unwrapped string, but wouldn't give you the "min" / "max" width type behavior you're describing here.

    Isomorphic Software


      Help please. How to setWrapHintText(false), when tooltip is for Grid Cell via HoverCustomizer?


        Hovers and hints are not the same thing (see docs). If you mean you want your hovered text to not wrap, either use <nobr> in your HTML or turn off wrapping via CSS (by setting a hoverStyle).