Solved

Dragging and dropping objects

Posted on 2003-10-28
2
178 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

708 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

16 Experts available now in Live!

Get 1:1 Help Now