Lots of ::mouseEnter, no ::mouseExit


Hi All

I have a problem with setting up a drag and drop system that I have traced to a bizarre bit of behaviour further up the stack from my draggee component.

The component in question never receives drag events. It does receive mouseDown, but not mouseDrag. Putting a counter on ::mouseEnter and ::mouseExit I have found that the ::mouseExit is never getting called. The ::mouseEnter is getting called continuously.

Interestingly, I use the same component in another area on the screen where it can receive all of the above as expected. In this case, it only receives the number of ::mouseEnter calls you would expect.

The component in question lives within a ViewPort, where it is in turn a child of a Component. The related display hierachy is this:

TabbedComponent(Tab) < Component (containing instance of myComponent and ViewPort) < ViewPort < Component < [whole bunch of myComponent]

Any ideas what could be the problem here?

All help appreciated - solutions highly prized…



Sorry, can’t think of any reason why that’d happen… If you can give me some sample code that reproduces it I’ll certainly give it a whirl though.


Hi Jules

Just trying latest Juce and some experiments - then will send you some stuff that either reproduces it or deconstructs the application enough to show me what the issue is.

Thanks for the quick response.



Tested against latest Juce - same behaviour.
Jules: Sending you a .zip file with minimized code to reproduce the problem.
I trust I am not doing something dumb…



Further potential clue:
Juce 1.51

juce_mouseinputsource.cpp. The drag event originates at L238 for all components displayed EXCEPT my components inside the Viewport subcomponent. These will get mouseMove; ::isDragging() always appears false when over these components.




I found it, and it was something dumb :oops:

In my paint method, components were getting deleted and re-created - so what appeared on the screen as a continuous component was actually a whole series of instances of the component. I had inadvertantly built a loop between the ::paint method and the MouseInputSourceInternal::setComponentUnderMouse method - hence a whole bunch of calls to ::mouseEnter, but not so many to ::mouseExit as the component was no longer around.

So - my own issue.

Thanks for the rapid response Jules - much appreciated.

As you were - ahem.

Crawls off into corner…



Thanks Don - no need for apologies, I’ve been stuck on similar problems myself, many times!