Question

I want to find out if a dragged control has been released outside any target.

One would think that OnDragEnd should be used, but that event doesn't work (they forgot to call the DragEnd procedure in the FMX.Types unit).

As an alternative, I tried OnMouseUp for the dragged control. Doesn't work. Doesn't get triggered when DragMode=dmAutomatic.

As a last resort, I tried to override the MouseUp procedure of the form itself (since all mouse events go through the form before being handed down to the respective control). Surprise: the MouseUp procedure does not get called when the control's DragMode=dmAutomatic.

Amazing how something this very simple is this extremely hard to achieve, but I'm hoping someone might have found a working solution.

Was it helpful?

Solution

It is possible to override the form's DragLeave method. This method is called for all objects that get dropped outside of a target area.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top