TDragDropURL

 
     

 

 

  Description
 
  TDragDropURL is a comfortable and powerful component for COM/OLE drag&drop operations with URLs. The component is a child-class from TDragDrop.
   
  Important for Use
 
  This file (index.htm) contains more information about restrictions, the disclaimer, remarks etc.
   
  History
 
  Version 1.10 published on 06-Jul-1999
 
  • Code re-design in result of modifications in TDragDrop; handling hasn't changed
  • In result of the code re-design the clipboard-bug under Win95 was fixed
  Version 1.00 published on 06-Aug-1998
 
  • First official release
   
  Properties
 
  inherited properties
  Click here ...
 
  ScrapFileName public
  If you drop the URL string on the desktop, there will be created a link to the URL. These link files are called "scrap files". You can set the name of this file with this property.
 
  URL public
  For Target: Use this string in OnProcessDropped, if you want to get the dropped URL.

For Source: Add the URL to this string, which you want to drag&drop, before calling Execute.

   
  Events
 
  inherited events
  Click here ...
 
  Methods
 
  inherited methods
  Click here ...
 
  Execute public
  Call this method, if you detect that the user wants to start a drag&drop operation (e.g. MouseDown+MouseMove). Also look: URL.

For drag detection you can also use the inherited property AutotDetectDnD or the method StartDnDDetection.

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 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!
   
  Known Bugs
 
 
  • I hope, you never find one
   

© 1998,99 by Dieter Steinwedel

Back to index