addMouseListener doesn't work on TreeView

Hi Jules,

Why addMouseListener() doesn’t work for TreeView() component?

void 	MainComponent::mouseDoubleClick (const MouseEvent &e)
// do something here

tv = new TreeView();
addAndMakeVisible( tv );

addMouseListener(this, false);


It does work, but you’re misunderstanding what you’re dealing with. The treeview is a complicated structure containing layers of sub-components - adding a listener to the parent is pretty pointless, because all the mouse-events are landing on the components inside the treeview, and not on the treeview itself.

Hi Jules,

Ok, I knew it while debugging it and how to make it works?
Little sample woud be better.


Since you never said what you’re actually trying to do, it’d be very difficult for anyone to tell you how to do it.

Thank you very much.

May all living being be happy