# Make a childComponent transparent to Mouse Clicks

**URL:** <https://forum.juce.com/t/make-a-childcomponent-transparent-to-mouse-clicks/3282>\
**Category:** General JUCE discussion\
**Created:** [October 12, 2008, 3:04pm UTC](https://forum.juce.com/t/make-a-childcomponent-transparent-to-mouse-clicks/3282 "2008-10-12T15:04:27Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![asair](https://avatars.discourse-cdn.com/v4/letter/a/e79b87/32.png) [@asair](https://forum.juce.com/u/asair)\
**Post date:** [October 12, 2008, 3:04pm UTC](https://forum.juce.com/t/make-a-childcomponent-transparent-to-mouse-clicks/3282/1 "2008-10-12T15:04:27Z")

</div>

how is this possible, to allow parent component intercepts mouse clicks ?

i set my ParentComponent "setInterceptsMouseClick(true,true)"  
but the hitTest/contains/reallyContains methods only work when I click directly on the ParentComponent background.

thanks

---

<div class="post-metadata">

**Author:** ![asair](https://avatars.discourse-cdn.com/v4/letter/a/e79b87/32.png) [@asair](https://forum.juce.com/u/asair)\
**Post date:** [October 12, 2008, 4:42pm UTC](https://forum.juce.com/t/make-a-childcomponent-transparent-to-mouse-clicks/3282/2 "2008-10-12T16:42:59Z")

</div>

it was becaus eof such troubles that i was first looking for an openGl solution.

Im developping many windows in a main big window.

by clicking onto daughter windows since the main mother window instance, i d like to activate daughter window callback  
(for example : flip(), randomizeChlidren(), …)  
and above all function will let me attach many daughter windows alltogether since anchor button on these windows.

---

<div class="post-metadata">

**Author:** ![asair](https://avatars.discourse-cdn.com/v4/letter/a/e79b87/32.png) [@asair](https://forum.juce.com/u/asair)\
**Post date:** [October 12, 2008, 5:52pm UTC](https://forum.juce.com/t/make-a-childcomponent-transparent-to-mouse-clicks/3282/3 "2008-10-12T17:52:55Z")

</div>

is passing a getParent-\>MouseDown(e) in the daughter window MouseUp function is realistic ?

---

<div class="post-metadata">

**Author:** ![asair](https://avatars.discourse-cdn.com/v4/letter/a/e79b87/32.png) [@asair](https://forum.juce.com/u/asair)\
**Post date:** [October 13, 2008, 6:19pm UTC](https://forum.juce.com/t/make-a-childcomponent-transparent-to-mouse-clicks/3282/4 "2008-10-13T18:19:44Z")

</div>

i managed to pass mouseEvent to parent.  
But i get strange e.x, e.y,  
as if the getRelativeTo did not work.

---

<div class="post-metadata">

**Author:** ![ptomaine](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ptomaine/32/245_2.png) [@ptomaine](https://forum.juce.com/u/ptomaine)\
**Post date:** [October 15, 2008, 12:51pm UTC](https://forum.juce.com/t/make-a-childcomponent-transparent-to-mouse-clicks/3282/5 "2008-10-15T12:51:18Z")

</div>

use Component::addMouseListener for your needs

---

<div class="post-metadata">

**Author:** ![asair](https://avatars.discourse-cdn.com/v4/letter/a/e79b87/32.png) [@asair](https://forum.juce.com/u/asair)\
**Post date:** [October 18, 2008, 1:16pm UTC](https://forum.juce.com/t/make-a-childcomponent-transparent-to-mouse-clicks/3282/6 "2008-10-18T13:16:24Z")

</div>

Really ?

It does not seem to be suffisant…  
A chlid component always mask the parent one.

---

<div class="post-metadata">

**Author:** ![zamrate](https://avatars.discourse-cdn.com/v4/letter/z/f4b2a3/32.png) [@zamrate](https://forum.juce.com/u/zamrate)\
**Post date:** [October 18, 2008, 4:53pm UTC](https://forum.juce.com/t/make-a-childcomponent-transparent-to-mouse-clicks/3282/7 "2008-10-18T16:53:34Z")

</div>

I think the way you are using setInterceptsMouseClicks is wrong (atleast if you are using it on the parent, as stated above, this will not work).

You have to do this: childComponent-\>setInterceptsMouseClicks(false,false);  
That’s how I did it and it worked for me.

Or perhaps also try parentComponent-\>setInterceptsMouseClicks(true,false); ,but I’m not sure if that one will work.

---

<div class="post-metadata">

**Author:** ![asair](https://avatars.discourse-cdn.com/v4/letter/a/e79b87/32.png) [@asair](https://forum.juce.com/u/asair)\
**Post date:** [October 18, 2008, 10:16pm UTC](https://forum.juce.com/t/make-a-childcomponent-transparent-to-mouse-clicks/3282/8 "2008-10-18T22:16:00Z")

</div>

Not possible cause I need my chlid to intercepts some clicks too.

The way getEventToRelative… is the good way.
