?
Solved

Delphi like drag & drop

Posted on 2004-04-05
10
Medium Priority
?
465 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 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

Introducing Priority Question

Increase expert visibility of your issues by participating in Priority Question, our latest feature for Premium and Team Account holders. Adjust the priority of your question to get emergent issues in front of subject-matter experts for help when you need it most.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses
Course of the Month14 days, 20 hours left to enroll

770 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