Solved

Delphi like drag & drop

Posted on 2004-04-05
10
453 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
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
 
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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now