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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Showing a drag image?
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

PeterPanino

901 Posts

Posted - Dec 15 2023 :  14:47:04  Show Profile  Reply
TImageEnView has an amazing feature - it allows an image to be dragged and dropped onto e.g. File Explorer:

// Drag Example:
// Allow image to be dragged from a TImageEnView (to Windows Explorer, for example)
procedure TForm1.ImageEnView1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
var
  ssFiles: TStringList;
begin
  if GetKeyState(VK_LBUTTON) < 0 then // Mouse left button is down
  begin
    ssFiles := TStringList.Create;
    ssFiles.Text := ImageEnView1.IO.Params.FileName;
    IEFileDragDrop1.InitiateDragging( ssFiles, [iedaCopy] );
    FreeAndNil(ssFiles);
  end;
end;


This would be even better if a semi-transparent drag image were displayed while dragging, like when dragging an image inside File Explorer:



Hi Nigel, do you think you could make this possible?

BTW, I tried the same with the ImageEnMView database demo by dragging a single selected image:

procedure TForm1.ImageEnMView1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
var
  ssFiles: TStringList;
begin
  if GetKeyState(VK_LBUTTON) < 0 then // Mouse left button is down
  begin
    ssFiles := TStringList.Create;
    ssFiles.Text := ImageEnMView1.SelectedFilename;
    IEFileDragDrop1.InitiateDragging( ssFiles, [iedaCopy] );
    FreeAndNil(ssFiles);
  end;
end;


However, this crashed the program! Is there a way to do this with a single selected image in the ImageEnMView in the database demo?

xequte

38418 Posts

Posted - Dec 15 2023 :  18:41:48  Show Profile  Reply
Hi Peter

Set IEFileDragDrop1.ShowPreview := True;

Regarding the ImageEnMView crash, are these physical files, or blobs in the database? If you want to allow dragging of blobs, you need to save them to temp files and then initiate dragging

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

PeterPanino

901 Posts

Posted - Dec 16 2023 :  13:59:18  Show Profile  Reply
Hi Nigel,

Thanks for the information!

After adapting it to my requirements, it works perfectly now!
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: