Component::addMouseListener question


#1

Hi everyone!

Please, a quick answer to a quick question :wink:

If I apply a mouse listener to a parent Component:

And then, a childComponent broadcasts a mouse event towards their parent, How does I know what child fires such event?
(because the parentComponent owns several childComponents)

Thank you,

Gabriel


#2

Ok, quick answer :

Component *const originalComponent is a public attribute of the mouse event and I think it should do the trick

See : http://www.rawmaterialsoftware.com/juce/api/classMouseEvent.html


#3

OK Dinaiz,

But the callback is hosted in the parentComponent, the only parameter passed to the parent through the callback is:

(among other events.)

I know that MouseEvent class has two members: eventComponent and originalComponent. I’ve done some checks and it worked.
So what is the convenient one for this purpose?

Gabriel


#4

No idea, in that case, I guess they are the same …