addMouseListener doesn't work on TreeView


#1

Hi Jules,

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


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

MainComponent::MainComponent(....)
{
tv = new TreeView();
addAndMakeVisible( tv );

addMouseListener(this, false);

}

#2

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.


#3

Hi Jules,

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

Thanks


#4

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.


#5

Thank you very much.

May all living being be happy