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
 TIEFileDragDrop - multiple controls
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

aleatprog

135 Posts

Posted - Nov 27 2023 :  14:00:26  Show Profile  Reply
Hi,

if the form contains more than one ImageEnView (e.g. ImageEnView1, ImageEnView2), is it possible to use TIEFileDragDrop to drag an image from Explorer and drop it to ImageEnView1 or ImageEnView2?

I tried by overwriting IEFileDragDrop.DropControl but without success.

Ale

xequte

38686 Posts

Posted - Nov 27 2023 :  14:02:37  Show Profile  Reply
Hi Ale

You can just enable AllowDrop:

http://www.imageen.com/help/TImageEnView.AllowDrop.html

Also: https://www.imageen.com/ieforum/topic.asp?TOPIC_ID=4439

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

aleatprog

135 Posts

Posted - Nov 28 2023 :  08:04:48  Show Profile  Reply
Thank you, Nigel. That's beautifully simple. : )

May I ask you how you would manage drag and drop on a form with the controls TImageEnView, TImageEnMView and TCheckListBox, where the drop on each control executes a different code?

I thought to check the mouse position while dropping. Do you got an alternative or easier way to prefer?

Ale
Go to Top of Page

xequte

38686 Posts

Posted - Nov 28 2023 :  19:37:56  Show Profile  Reply
Hi Ale

Yes, if you are using form dropping code, then the easiest way is probably just to check the CursorPos() in your drop event to calculate which control is under the cursor (and disable all the special handling in the ImageEn controls).

Alternatively instead of forum dropping code, you can use TIEFileDragDrop to allow dropping to your non-ImageEn controls:

https://www.imageen.com/help/TIEFileDragDrop.html


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

aleatprog

135 Posts

Posted - Nov 29 2023 :  04:33:21  Show Profile  Reply
Hi Nigel,

FormDrop vs. TIEFileDragDrop is exactly what I'm valuating.

I saw that using multiple TIEFileDragDrop objects allow to drop on multiple controls. In the TIEFileDragDrop help documentation, memory management is an issue (RegisterExpectedMemoryLeak).

With FormDrop, I free the resources using DragFinish.

Using the combination (1) ImageEnView.AllowDrop + (2) TIEFileDragDrop1.DropControl := ImageEnMView + (3) TIEFileDragDrop2.DropControl := CheckListBox, what would be the correct way to free the resources?

Ale
Go to Top of Page

xequte

38686 Posts

Posted - Nov 29 2023 :  13:44:22  Show Profile  Reply
Hi Ale

Memory management is not an issue, because as long as the DragDrop (and your CheckListBox) exists through the life of the application it will be freed automatically when the app closes. To prevent a warning just call RegisterExpectedMemoryLeak(MyDragDrop).

Otherwise, if you prefer, you can explicitly free the DragDrop object in the normal way.


Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: