I am having an issue with drag and drop that I after many attempts I have not been able to solve. I have a component inside a custom tree (not using the juce::TreeView) that I need to be able to drag and drop. However, there are events in my program that can cause that particular component to get replaced by a different one mid-drag. I don’t want to get into a discussion on why I am doing this, so let’s assume there is no other way to implement my system.
The issue is that when the component that triggers the original mouse event gets replaced, no mouse event is tracked, and therefore my drag and drop freezes in place until I let go of the mouse button.
I’ve tried adding a persistent mouse listener to this component, in the hopes that it would send the mouse events to the drag and drop system. This didn’t work.
I’ve tried persisting the original component, but it necessarily gets re-parented and the drag and drop is also lost anyway. This didn’t work.
I’ve tried creating mouse events based of the original…but apparently this is a big no, and doens’t work. I really hope this is possible in some way or another, because not being able to manually start a mouse event leads to some very big (tangential) issues.
Thank you for taking the time to read this. I’ll keep trying to find ways around this, and try to understand exactly how JUCE manages mouse events in the meantime.