?
Solved

Delphi like drag & drop

Posted on 2004-04-05
10
Medium Priority
?
469 Views
Last Modified: 2010-04-16
Hi,

I would like to make drag & drop work in my app  the same way as in the Delphi IDE:  It  displays a  transparent rectangle which has the size of dragged object, instead of moving the object itself.

Any help is appreciated.

Regards,
CC
0
Comment
Question by:cc042297
  • 4
  • 3
  • 2
9 Comments
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10760924
We can give you a better answer, if we knew, First, what are you dragging, second, from what, to what?

Shane
0
 

Author Comment

by:cc042297
ID: 10761332
Hi Shane,

It could be anything on the form, a control, a picture, which needs to be draged at runtime. The question is not really about drag & drop mechanism, but about showing a semitransparent dragimage (with the size of the draged object). There is a "Jedi" control which can be moved and resized on the screen at runtime, but it simply moves the control while it is dragged. Because of this it blinks and leaves "footprints"  behind.
0
 
LVL 46

Assisted Solution

by:aikimark
aikimark earned 400 total points
ID: 10766924
1. There's a decent Raize component that may help you during Drop operations.
2. If the dragging takes place from an application in another application, you have more limited options over the drag shape.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 11

Accepted Solution

by:
shaneholmes earned 800 total points
ID: 10767061
This is a tough one...

You will need to decend from the TDragObject and override its methods.

{Search Google for examples on decending from TObject}

You will then need to use the TImageList's SetDragImage, ShowDragImage, HideDragImage methods.

However, the image part is tricky, cause the image (changes) is dynamic and  dependent on the object you are moving, therefore, you wont know the image until then.

You could get s screen capture of that particular region (the object your moving), and invert (colors) it, and use that as the drag image.


Shane
0
 
LVL 46

Expert Comment

by:aikimark
ID: 10767275
correction:

2. If the dragging takes place from another application, you have limited options over the drag shape.

0
 
LVL 46

Expert Comment

by:aikimark
ID: 10855709
CC,
Are you still with us?
0
 

Author Comment

by:cc042297
ID: 10878743
aikimark

Thanx for reminding me! :)

I tried to do it Shane's way. Spent some time on learning how Delphi handles drag and drop. If  I'm not mistaken there is a problem with it. But I’m not sure yet. I didn't want to say anything till I'm not certain.  Right now I have other things to do, but I will be back as soon as I can. :)

Regards,
CC
0
 

Author Comment

by:cc042297
ID: 13193487
Well, after checking all avaible Delphi sources I have come to conclusion that it is not possible to dot it by using D&D offered by  Delphi & Windows. The code which displays the Drag image is in Windows and there is no way I can make it work the way I wanted. At least I did not find any. So finally I have built my own Drag&Drop from the bottom. Took me much less time then what I had previously spent on trying to do it the Delphi & Windows way.

I still appreciate your help, so the points will be splitted.

Thanx, CC.
0
 

Author Comment

by:cc042297
ID: 13193636
I have come to conclusion -> I have come to the conclusion :)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses
Course of the Month13 days, 8 hours left to enroll

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question