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);
}
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.