# Tooltip window too small

**URL:** <https://forum.juce.com/t/tooltip-window-too-small/24344>\
**Category:** General JUCE discussion\
**Created:** [September 23, 2017, 4:52pm UTC](https://forum.juce.com/t/tooltip-window-too-small/24344 "2017-09-23T16:52:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![adamwilson](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/adamwilson/32/1387_2.png) [@adamwilson](https://forum.juce.com/u/adamwilson)\
**Post date:** [September 23, 2017, 4:52pm UTC](https://forum.juce.com/t/tooltip-window-too-small/24344/1 "2017-09-23T16:52:50Z")

</div>

I’m trying to work out how to increase the size of my tooltip window (without hacking into JUCE!)

I wonder if its something to do with the font I’m using…?

![35](https://us1.discourse-cdn.com/flex026/uploads/juce/original/2X/c/c25898e596787db2cd950ddbe42708c1ca469535.png)

Is there a way of setting the size of the TooltipWindow? Calling `setSize` seems to have no effect. I guess it works it out from the font+text size.

---

<div class="post-metadata">

**Author:** ![adamwilson](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/adamwilson/32/1387_2.png) [@adamwilson](https://forum.juce.com/u/adamwilson)\
**Post date:** [September 23, 2017, 5:55pm UTC](https://forum.juce.com/t/tooltip-window-too-small/24344/2 "2017-09-23T17:55:19Z")

</div>

Reducing the font size seems to get the text to fit, however, it then becomes tiny.

My L&F code:

```auto
    void drawTooltip (Graphics& g, const String& text, int width, int height) override
    {
        Rectangle<int> bounds (width, height);
        const auto cornerSize = 5.0f;

        g.setColour (findColour (TooltipWindow::backgroundColourId));
        g.fillRoundedRectangle (bounds.toFloat(), cornerSize);

        g.setColour (findColour (TooltipWindow::outlineColourId));
        g.drawRoundedRectangle (bounds.toFloat().reduced (0.5f, 0.5f), cornerSize, 1.0f);

        layoutTooltipText (text, findColour (TooltipWindow::textColourId))
                .draw (g, Rectangle<float> ((float) width, (float) height));
    }

    static TextLayout layoutTooltipText (const String& text, Colour colour) noexcept
    {
        const float tooltipFontSize = 15.0f;
        const int maxToolTipWidth = 400;

        AttributedString s;
        s.setJustification (Justification::centred);
        s.append (text, Font (tooltipFontSize), colour);

        TextLayout tl;
        tl.createLayoutWithBalancedLineLengths (s, (float) maxToolTipWidth);
        return tl;
    }

```

---

<div class="post-metadata">

**Author:** ![railjonrogut](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/railjonrogut/32/505_2.png) [@railjonrogut](https://forum.juce.com/u/railjonrogut)\
**Post date:** [September 23, 2017, 6:38pm UTC](https://forum.juce.com/t/tooltip-window-too-small/24344/3 "2017-09-23T18:38:26Z")

</div>

LookAndFeel\_V2::getTooltipBounds()

[https://www.juce.com/doc/classLookAndFeel\_\_V2#a6af715d801db915d661e103603a2e721](https://www.juce.com/doc/classLookAndFeel__V2#a6af715d801db915d661e103603a2e721)

Rail

---

<div class="post-metadata">

**Author:** ![adamwilson](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/adamwilson/32/1387_2.png) [@adamwilson](https://forum.juce.com/u/adamwilson)\
**Post date:** [September 23, 2017, 7:09pm UTC](https://forum.juce.com/t/tooltip-window-too-small/24344/4 "2017-09-23T19:09:13Z")

</div>

Aha, yes, missed that, sorted cheers 👍
