Author |
Topic |
|
aleatprog
132 Posts |
Posted - Nov 27 2023 : 14:00:26
|
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
38608 Posts |
|
aleatprog
132 Posts |
Posted - Nov 28 2023 : 08:04:48
|
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 |
|
|
xequte
38608 Posts |
Posted - Nov 28 2023 : 19:37:56
|
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
|
|
|
aleatprog
132 Posts |
Posted - Nov 29 2023 : 04:33:21
|
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 |
|
|
xequte
38608 Posts |
Posted - Nov 29 2023 : 13:44:22
|
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
|
|
|
|
Topic |
|