|
How Do I Use It As Drag&Drop Source |
|
|
1. |
Drop a TWinControl on the form (e.g.
a memo). |
|
2. |
Choose the TWinControl (memo) in DragDropControl. |
|
3. |
Choose the drag&drop effects
under SourceEffects which the DragDropControl (memo)
should support. If you don't want any longer that the DragDropControl
serve as drag&drop source all items must be set to
false. |
|
4. |
Now, your DragDropControl
(memo) must detect, when the user wants to start a drag&drop
operation. You can use the event "OnMouseDown"
of your DragDropControl (memo).
Add following to the event:
DragDropURL1.URL:=<selection
of DragDropControl (memo)>);
|
|
5. |
Tell Windows that
there is a drag&drop operation to handle: Just call
the method Execute of this component. |
|
6. |
You may use
the events OnGiveFeedback and OnQueryContinueDrag, but often you need not. |
|
|
|
|
Hints: |
|
- Drag&drop
operations cannot be done at design-time!
- IMPORTANT: If you use
the drag-detection, it's high recommended to
check the section "Problems With The Drag-Detection".
|
|
|
|
How Do I Use It As Drag&Drop Target |
|
|
1. |
Drop a TWinControl on the form (e.g.
a memo). |
|
2. |
Choose the TWinControl (memo) in DragDropControl. |
|
3. |
Choose the drag&drop effects
under TargetEffects which the DragDropControl (support.
If you don't want any longer that the DragDropControl
(memo) should serve as drag&drop target all items
must be set to false. |
|
4. |
Now, you have to program
what happen, if the user drops an URL on your DragDropControl (memo). For this, the best is to
use the event OnProcessDropped. At first, you should check what
drag&drop effect was chosen by the user. You get the
effect from method's parameter dwEffect.
You get the URL from this component with following line:
...:=DragDropURL1.URL;
|
|
5. |
You may use
the events OnDragEnter, OnDragOver and OnDragLeave, but often you need not. |
|
|
|
|
Hints: |
|
- Drag&drop
operations cannot be done at design-time!
|
|
|