TooltipWindow with multiscreen issue

When TooltipWindow was used without parentComponent (the TooltipWindow will appear on the desktop)
Tooltips can be split on two screens and are not easily readable.
(if the mouse was near the left border of the right screen for example).

Its because TooltipWindow::showFor() method was based on desktop size.

Modify this method by adding the following code before the setBounds (x, y, w, h) call seems to resolve this issue.


    if (getParentComponent() == 0)
        // juce5.1 : const Rectangle monitorArea = Desktop::getInstance().getMonitorAreaContaining(mx, my);
        const Rectangle<int> monitorArea = Desktop::getInstance().getMonitorAreaContaining(mousePos);       
        if (x < monitorArea.getX())
            x = monitorArea.getX();
        if (y < monitorArea.getY())
            y = monitorArea.getY();

    setBounds (x, y, w, h);

Hope this can help

Thanks, that’s a good point, I’ll add something to handle that…!

just discovered a similar issue; I have my secondary work monitor in portrait configuration, so my ‘actual’ desktop is a lot taller than the main display’s viewable area. I just used a combobox with 700 entries in, and the drop-down list went way off the bottom of the main screen :slight_smile:

[EDIT] although, peculiarly, it doesn’t seem to happen now. Mysterious!

Hmm, ok… does it sort it out if you change line 814 to:

const int maxMenuH = getParentMonitorArea().getHeight() - 24;


It’s quite strange - the first time it shows (my UI control currently starts empty, so there’s no initial item for it to have selected), the list goes off the main monitor (though it fits within the screen bounds on the other screen). However, after one has been selected, it does fit within the screen bounds. BUT… if I scroll to the bottom of the list (the arrow is no longer visible, and I recognise the final item), the cursor-down key will happily continue highlighting non-existent items off the end of the list (i.e., if i hold ‘down’ for two seconds, it takes two seconds of holding ‘up’ for the selection bar to reappear. Odd! Probably only to do with the fact that it’s such a massive list.

Also note, though, that I really don’t care about it at the moment :slight_smile: so I wouldn’t feel under any pressure to fix it!