Link to home
Start Free TrialLog in
Avatar of Matt2000
Matt2000

asked on

TDragObject

I know this sounds like I just want you to write code for me, but I HAVE tried to figure this one out. I'm implementing some drag and drop into my program. When a user starts dragging, I need to display a custom cursor/image, moving with mouse. I've done a little reading, and I found the TDragObject and TDragImageList, but I cant seem to get them to work. What I want is to have two TImage's, one with a picture and one without. When a user drags the first with a picture, the cursor turns into the picture (or at least displays behind the cursor) and moves and can be "dropped" into the second TImage. Just a simple example will get me on my way. :)
ASKER CERTIFIED SOLUTION
Avatar of CrazyOne
CrazyOne
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of inthe
inthe

Hi,
i would make life easy and say look at :

http://www.melander.dk/delphi/dragdrop/index.html

one of the examples is doing just as you want.

Regards Barry
Avatar of Matt2000

ASKER

ok.. I didnt think it would be this hard, but for some reason I cannot find ANYWHERE (I've spent the last 3 hours searching) an example of what I'm looking for. Those components are nice, Barry, but I'm going to need to be able to do it another way. For one, I dont want my dragging and dropping available to other apps. And second, I'm going to be making some major modifications to the object being dragged..  the visual part is one minor aspect. Anyways.. if anybody has an example, please :)
........  it figures...... I finally got it. I'm not going to delete the question tho, because theres nothing I hate more than finding the exact question I wanted on here and then seeing that it was deleted :) so, I'm going to clean up the coding tomorrow and post it, then figure out something to do with the points...
Ok.. the trick is in the GetDragImages. A class of TControl with the GetDragImages function overriden to return an internal (or external) TDragImageList will do it. The other thing is in the ControlStyle. Over any control that you want to display the image over (including the drag source class) you need to add [csDisplayDragImage] to its ControlSytle set.