1

I got no answer from the official forum of JUCE and I am trying to ask here and hope.

Here is my problem:

I want to register/hook a mouseDoubleClick event to juce::TreeView class or it's derivation.

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

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

addMouseListener(this, false);

}

The code above doesn't work and no answer from the JUCE creator. My question is how to make it work? It should be able to be explained in simple example. The addMouseListener() would be inconsistent and it should be documented such as "addMouseListener will not work on some classes such as TreeView". I will be happy to find it on the documentation and avoid using previous techniques.

1
  • 1
    What's the actual error that you're getting? Would it work for you to instead implement itemDoubleClicked() in the classes derived from TreeViewItem that you're storing in the TreeView?
    – bgporter
    Mar 17, 2011 at 15:11

1 Answer 1

2

Sorry for the late answer, but...for the record :

What you're doing here is adding a MouseListener to your main component, and telling it not to forward the events to it's children (2nd param == false), so the behaviour is pretty normal.

IMHO it should work if you wrote instead :

tv->addMouseListener(this, false);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.