Solved

Dragging and dropping objects

Posted on 2003-10-28
2
180 Views
Last Modified: 2010-04-05
Hello!

I'm quite new to Delphi and I know how things should work in theory because I have been programming with other languages for years. I'm trying to make a simple image browser with one form.

On Form1 I have two Scrollboxes. In the first Scrollbox I would like to put the objects (thumbnail images which are created on run-time).

And then I have a second Scrollbox. The thumbnails which I have in Scrollbox1 are based on the code found at http://www.b-zone.de/zips/thmbnail.zip

The biggest problem I have is that I don't know how to drag a object from Scrollbox1 to Scrollbox2.
0
Comment
Question by:mazze
2 Comments
 
LVL 3

Accepted Solution

by:
huferry earned 125 total points
ID: 9632848
The theory is:

The source component:
- Set the property DragMode to dmAutomatic
- Use the event OnStartDrag
- Pass your parameter as an TDragObject instance

The target component:
- Use the event OnDragOver, based on the Sender and
  the Source you can decide either to accept or reject it.
- Sender = source component; Source = Drag object
- Use the event OnDragDrop to handle the object dropping.
  Again, you'll get the Sender and the Source
- TDragObject will be automatically destroyed.

happy trying!

regards,
huferry
0
 

Author Comment

by:mazze
ID: 9640111
Thanks! I finally solved the problem even if it took several hours for me to do it.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

832 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