# Offset of the CallOutBox

**URL:** <https://forum.juce.com/t/offset-of-the-calloutbox/48157>\
**Category:** General JUCE discussion\
**Created:** [October 7, 2021, 1:10pm UTC](https://forum.juce.com/t/offset-of-the-calloutbox/48157 "2021-10-07T13:10:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![PierreGuillot](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/pierreguillot/32/11653_2.png) [@PierreGuillot](https://forum.juce.com/u/PierreGuillot)\
**Post date:** [October 7, 2021, 1:10pm UTC](https://forum.juce.com/t/offset-of-the-calloutbox/48157/1 "2021-10-07T13:10:13Z")

</div>

Hello,

It seems that the `juce::CallOutBox` is sometimes shifted vertically to the bottom. In this example, the `juce::CallOutBox` is not attached to a component and should display a rectangle with its origin at the mouse position. I tested on macOS and Windows with Juce 6.1.2 (master) and 96612b1 (develop).

I click at the bottom of the window and the position seems good:

 ![_Good](https://us1.discourse-cdn.com/flex026/uploads/juce/original/2X/8/81f34f615a5857f4591e35a8562a4700f6611b1b.jpeg)

I click at the top of the window and the position seems bad:

 ![_Bad](https://us1.discourse-cdn.com/flex026/uploads/juce/original/2X/7/740e5916557254a9466bb492856a7c7fefb6efbc.jpeg)

Code:

```auto
void MainComponent::mouseDown (juce::MouseEvent const& e)
{
    class Rect
    : public juce::Component
    {
    public:
        Rect()
        {
            setSize(300, 200);
        }
        
        void paint (juce::Graphics& g) override
        {
            g.fillAll(juce::Colours::whitesmoke);
        }
    };
    juce::CallOutBox::launchAsynchronously(std::make_unique<Rect>(), {e.getScreenX(), e.getScreenY(), 300, 200}, nullptr);
}

```

---

<div class="post-metadata">

**Author:** ![nicolasdanet](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/nicolasdanet/32/56_2.png) [@nicolasdanet](https://forum.juce.com/u/nicolasdanet)\
**Post date:** [October 7, 2021, 2:00pm UTC](https://forum.juce.com/t/offset-of-the-calloutbox/48157/2 "2021-10-07T14:00:42Z")

</div>

Your `areaToPointTo` in the `launchAsynchronously` is a big square with top left position at the cursor. IIRC according to the quarter where you click in the screen, the `CallOutBox` will be placed Up or Down or Left or Right to this `areaToPointTo` target (with the arrow pointed to the area).

In \_Good it is Up ; in \_Bad it is Down.

Thus for me it seems a normal behaviour. Am i wrong? 🤔

You should use a smaller size for the target to see what i mean (and click on screen borders).

```auto
juce::CallOutBox::launchAsynchronously(std::make_unique<Rect>(), {e.getScreenX(), e.getScreenY(), 10, 10}, nullptr);

```

---

<div class="post-metadata">

**Author:** ![PierreGuillot](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/pierreguillot/32/11653_2.png) [@PierreGuillot](https://forum.juce.com/u/PierreGuillot)\
**Post date:** [October 7, 2021, 2:37pm UTC](https://forum.juce.com/t/offset-of-the-calloutbox/48157/3 "2021-10-07T14:37:16Z")

</div>

Okay, I expected the `CallOutBox` to be placed in the rectangle but in fact, this is the _area that the call-out’s arrow should point towards_. I should have read the documentation more carefully. Thank you!
