ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 ImageEnFolderMView Drag and Drop

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
John Posted - Nov 19 2016 : 14:43:17
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
3   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Nov 22 2016 : 03:51:24
Hi John

OK, you are just using standard DragDrop methods.

Why not just delay the call to MessageDlg, e.g. by posting a message to the form.

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
John Posted - Nov 20 2016 : 23:51:51
Nigel

I have AutoDragFiles := [] and AutoDropFiles := []. Additionally, the OnDropFiles event does not fire. The two ImageEnFolderView components involved are both located on the same form.

I can successfully prevent moving a file from the source ImageEnFolderMView1 to the recipient ImageEnFolderMView2 via the event shown in the original post and below. The issue is that if I enable the remarked out MessageDlg in the code above, the messagedlg redisplays each time the OK button is depressed.

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);
        end;
    end
  else
     ......etc.



John
xequte Posted - Nov 20 2016 : 04:07:00
Hi John

If you are using the built in Windows compatible drag/drop (TImageEnFolderMView.AutoDragFiles) then you need to use the OnDropFiles event to cancel the drop:

http://www.imageen.com/help/TImageEnFolderMView.OnDropFiles.html

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com