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]
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.
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…
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.
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.