Additional hints: When using this Drag&Drop method in another project, I had to make the following changes to make it work as desired:
1. The original demo code started the Drag with: ImageEnMView1.IEBeginDrag(True, -1);
I had to set the parameter Immediate to False to avoid starting an unintentional DD move by just clicking an image: ImageEnMView1.IEBeginDrag(False, -1);
Not sure why this works differently as in the original demo project.
2. In my modification of the original demo project I had to use this workaround to insert the dragged image on the correct target position:
procedure TformImagesFromUrl.ImageEnMView1DragDrop(Sender, Source: TObject; X, Y: Integer);
var
im: integer;
begin
im := ImageEnMView1.InsertingPoint(X, Y);
if im < ImageEnMView1.SelectedImage then
ImageEnMView1.MoveSelectedImagesTo(im)
else
ImageEnMView1.MoveSelectedImagesTo(im + 1);
end;
However, this does not work in another project. In another project I have to use this code to make it work correctly:
procedure TformImagesFromUrl.ImageEnMView1DragDrop(Sender, Source: TObject; X, Y: Integer);
var
im: integer;
begin
im := ImageEnMView1.InsertingPoint(X, Y);
if im >= ImageEnMView1.ImageCount then EXIT; // !!
ImageEnMView1.MoveSelectedImagesTo(im);
end;
Also note the line if im >= ImageEnMView1.ImageCount then EXIT;
that is needed to interrupt the dragging move when the image is dragged to an empty space after the last image. Not sure why this works differently in another project.
3. I am also not sure why you use ImageEnMView1.MouseInteract := [];
in the original demo project at drag start. In another project, there are no problems when I don't deactivate MouseInteract at drag start.