# Bug in child window (vst plugin) mousedrag?

**URL:** <https://forum.juce.com/t/bug-in-child-window-vst-plugin-mousedrag/179>\
**Category:** General JUCE discussion\
**Created:** [February 11, 2005, 5:40pm UTC](https://forum.juce.com/t/bug-in-child-window-vst-plugin-mousedrag/179 "2005-02-11T17:40:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kunitoki](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/kunitoki/32/15_2.png) [@kunitoki](https://forum.juce.com/u/kunitoki)\
**Post date:** [February 11, 2005, 5:40pm UTC](https://forum.juce.com/t/bug-in-child-window-vst-plugin-mousedrag/179/1 "2005-02-11T17:40:14Z")

</div>

anyone have experienced bugs in mouseDrag if your component is a child window of a not-juce window ? i’ve compiled the test code for the vst plugin, but all mouse events occurred with an offset equal to the distance of that child window from the left/top screen… very weird…  
anyone have workaround for this ?

lou

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [February 12, 2005, 8:41pm UTC](https://forum.juce.com/t/bug-in-child-window-vst-plugin-mousedrag/179/2 "2005-02-12T20:41:47Z")

</div>

I’ve got a fix for this ready for the next version - it’s a bug in Component::getScreenX(). If you want to hack it temporarily, the code should be:

[code]int Component::getScreenX() const throw()  
{  
return (parentComponent\_ != 0) ? parentComponent\_-\>getScreenX() + compX\_  
: (hasHeavyweightPeerFlag ? getNativeWindow()-\>getScreenX()  
: compX\_);  
}

int Component::getScreenY() const throw()  
{  
return (parentComponent\_ != 0) ? parentComponent\_-\>getScreenY() + compY\_  
: (hasHeavyweightPeerFlag ? getNativeWindow()-\>getScreenY()  
: compY\_);  
}

[/code]

---

<div class="post-metadata">

**Author:** ![kunitoki](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/kunitoki/32/15_2.png) [@kunitoki](https://forum.juce.com/u/kunitoki)\
**Post date:** [February 14, 2005, 8:27am UTC](https://forum.juce.com/t/bug-in-child-window-vst-plugin-mousedrag/179/3 "2005-02-14T08:27:47Z")

</div>

thanx jules, you gr8 !!!

lou

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [May 12, 2017, 9:57am UTC](https://forum.juce.com/t/bug-in-child-window-vst-plugin-mousedrag/179/4 "2017-05-12T09:57:45Z")

</div>

Closed on May 12, 2017, 9:57am UTC


