I suspect at least one error in the Controls.DragTo procedure:
>
if DragImageList nil then
begin
if (Target = nil) or (csDisplayDragImage in Target.ControlStyle) or
DragObject.AlwaysShowDragImages then
begin
DragImageList.DragCursor := DragCursor;
if not DragImageList.Dragging then
DragImageList.BeginDrag(GetDeskTopWindow, Pos.X, Pos.Y)
else DragImageList.DragMove(Pos.X, Pos.Y);
end
else
begin
DragImageList.EndDrag; <-------------------------------- 1
Windows.SetCursor(Screen.Cursors[DragCursor]);
end;
end; <------------------------------------------------------ 2
Windows.SetCursor(Screen.Cursors[DragCursor]);
if ActiveDrag = dopDock then
[...]
<<1) EndDrag is called whenever the mouse moves over no valid target (Target=nil). IMO EndDrag should be called only once, when dragging is finished. EndDrag is not appropriate for hiding the drag image temporarily.
2) The duplicate call to SetCursor (and more) suggests to me that the second SetCursor should reside in the Else branch of the outer If, so that it is *not* called after DragImageList.DragMove, just as implemented in the inner If.
Opinions?
Lazarus uses almost the same implementation in TDragPerformer, what IMO should be fixed.
Furthermore I wonder whether it makes sense to show both a drag image *and* an docking frame (in the code below the above snippet, when ActiveDrag=dopDock).
DoDi
