Solved

Delphi like drag & drop

Posted on 2004-04-05
10
463 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
10 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 45

Assisted Solution

by:aikimark
aikimark earned 100 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
Industry Leaders: 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 200 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 45

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 45

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

717 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