Changing the ElemOnMouseDown from my attached project above and adding two new events makes it easy to get the behaviour that I want/expect (code bellow). But this kind of makes the whole BeginDrag(False, 5) moot, since I instead have to call BeginDrag(True) once I make sure the 5 pixel threshold is hit.
I'm attaching the demo project with these changes.
procedure TTest.ElemOnMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X,
Y: Integer);
begin
FStartingPoint := Point(X, Y);
FTrigger.OnMouseMove := @ElemOnMouseMove;
FTrigger.OnMouseUp := @ElemOnMouseUp;
end;
procedure TTest.ElemOnMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X,
Y: Integer);
begin
FTrigger.OnMouseMove := nil;
FTrigger.OnMouseUp := nil;
end;
procedure TTest.ElemOnMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
if FStartingPoint.Distance(Point(X, Y)) >= 5 then
begin
FTrigger.OnMouseMove := nil;
FTrigger.OnMouseUp := nil;
FTrigger.BeginDrag(True);
end;
end;
TControl.BeginDrag docs also mention how the set threshold is "Minimum mouse movement before
delayed dragging starts". But as I said before, both OnStartDrag is called and Dragging is set to True when the TControl is pressed, not when the dragging actually starts when using BeginDrag(False).
Unless the word
delayed in the docs means that the drag does starts from a mouse press but the process of dragging itself is delayed. But then again, that makes OnStartDrag() and Dragging; basically useless when using BeginDrag(False);.