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.

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top