Hello
I use the existing drag and drop functionality of the ImageEnFolderMView components to drag and drop images from ImageEnFolderMView1 to ImageEnFoldeMView2. Of the existing 5 drag and drop procedures associated with this component, only OnDragOver has a Boolean Accept parameter. I allow/reject dropping an image on the second component with the following code.
procedure TformPresentations.ImageEnFolderMView2DragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
var
imgX, imgY: integer;
tempInsertPoint: Integer;
begin
if Source = ImageEnFolderMView1 then
begin
if wwDBComboBoxExistingLayouts.ItemIndex = -1 then
begin
Accept := True;
end
else
begin
Accept := False;
// MessageDlg('New images can not be added to an existing presentation layout.',
// mtError, [mbOK], 0);
// Abort
end;
end
else
begin
if Source = ImageenFolderMView2 then
begin
Accept := true;
tempInsertPoint := ImageEnFolderMView2.InsertingPoint(X, Y);
imgX := ImageEnFolderMView2.ImageX[tempInsertPoint];
imgY := ImageEnFolderMView2.ImageY[tempInsertPoint];
ImageEnFolderMView2.Paint;
with ImageEnFolderMView2.GetCanvas do
begin
Pen.Color := clRed;
Pen.Style := psDot; // display a dotted line
Pen.Width := 1; // a dotted line only works if pen width is 1 otherwise it will be a solid line
// draw the line vertically at the insert point
MoveTo(imgX, imgY);
LineTo(imgX, imgY + ImageEnFolderMView2.ThumbHeight - 10);
end;
end;
end;
end;
Problem:
If I inform the user when an image is rejected by enabling the disabled MessageDlg, the message is repeated in infinitum irrespective of adding the Abort statement following the MessageDlg.
Suggestions??
John