Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How determine that a dragging operation has ended in FireMonkey?

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.

like image 959
Domus Avatar asked Jan 11 '12 01:01

Domus


Video Answer


1 Answers

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.

like image 81
Domus Avatar answered Nov 12 '22 11:11

Domus