DragAndDropAndBreaknUp

Hi (I hope this hasn't been covered before - forum search seem to have been economized though),

My Component can be dragged and dropped on my DragAndDropTarget components.

I would like to do a special operation (here: deleting the Component), when dropped on any other non-DragAndDropTarget Components. And I have a lot of them, so making all of them DragAndDropTargets and handling the special case is not feasible.

By overwriting DragAndDropContainer::dragOperationEnded() I can handle that.

But it would be nice if the DragAndDropContainer had a chance to do something before the dragImageComponent has been deleted. i.e. something like DragImageComponent::dismissWithAnimation(false). (Also dismissWithAnimation would then also need to be a non-private member.)

Any clues?

Thanks & cheers,

raketa

Hello,

dismissWithAnimation sounds a little too specific to your use case to be included in JUCE. You could however have a large invisible DragAndDropTarget to catch those that you wish to dismiss.

Hope this helps!

dismissWithAnimation sounds a little too specific to your use case to be included in JUCE.

its already included in JUCE. And sirved only as an example of what I would like to do in my drop callback.

You could however have a large invisible DragAndDropTarget to catch those that you wish to dismiss.

Sounds interesting. I thought invisible Components wouldn't receive mouse events. However that DragAndDropTarget would need to be on top of the components to dismiss, but my UI Component hierarchy is pretty complex and generic, so for now it looks a bit difficult to me to find the right layer. But I will think about that approach.

 

Oops, must have missed that! Hey, you taught me something about JUCE ;)

Glad to help. Hope it works out!

Glad to help. Hope it works out!

Well, not quite yet: Would this additional DragAndDropTarget component need to resided on top of other (visible) components or is it sufficient if it just covers the rest behind the currently implemented DragAndDropTarget targets? It seems to me that it will only receive drop notifications when beeing a top Component, or how is this intended to work? Can it have child Components? Can it be covered by other Components?

But actually the easiest would be if the DragAndDropContainer could be informed before dismissing the dragImageComponent.

Cheers & thanks,

raketa

Would be best if it went behind the other components, I guess.

Not sure about whether adding a callback would be a good solution. Maybe something more generic like allowing you to supply a custom Component to use as the drag image would be a better approach, but it wouldn't be a high priority for us to do that right away.

Thanks, Jules,

that works!

 

Cheers,

raketa