Drag and drop gets itemDropped without getting itemDragEnter


#1

im not sure if this is a bug, and i can make a small hack that deals with this, but still, here goes:

I have a drag and drop target component which has an animated menu over it. if i drop the item when the menu is closing itself, the drag and drop target’s itemDragEnter() method is not called, but the itemDropped() method is called. which makes me delete something that was not created in the itemDragEnter() method.

isnt it a bit illogical for itemDropped() to be called without itemDragEnter() ? its a bit like calling mouseDown() without having mouseEnter() being called…

also, there has been a recent change in the way this works, where itemDragExit() is being called after itemDropped() - which also seems counter intuitive for me. imho it should be one or the other.

i can do the checkups needed to avoid this, but i have a feeling this will complicate things for other users as well, and if its going to be changed, i would rather avoid putting those checkups in my own code, and let juce handle it.

what do you think?

much thanks,
Assaf


#2

Yes, I should clarify the exact behaviour of those calls, I guess. Though I’m not convinced that it should be verboten for a ‘drop’ event to happen without an ‘enter’ before it. E.g. you might want to programmatically call a drop method and would still expect it to work.

Even with mouse-down events, you should be careful never to write code that fails if there hasn’t been a mouse-enter before it. I think in the wrapper there’s code to try to avoid those situations happening, but you should still be able to deal with the situation if it arises.


#3

oki, ill make the checks on my code.
cheers!