Class TDragFilesTrg (unit uDragFilesTrg)

Inherits from

TComponent

TDragFilesTrg Component © Angus Johnson ajohnson@rpi.net.au Version 1.0 September 1997. DESCRIPTION: Enables dragging of filesnames FROM Windows Explorer TO your Form. Single or multiple files can dragged and then acted upon in the OnDrop event. PUBLISHED PROPERTIES: Enabled: boolean; Target: TWinControl PUBLIC PROPERTIES: (not available at design time) DropPoint: TPoint FileList: Tstrings METHODS: OnDrop: TNotifyEvent USAGE: 1. Add this non-visual component to the Form you wish to drag TO. 2. Select the Target Component (eg: ListView, Listbox etc.). This is the component which will register the Drop Event (ie: the cursor changes to a valid drop cursor over this component.) Note: It doesn't HAVE to be the component will display the dropped files although it does makes more visual sense if it is. 3. Set enabled to true. (Under some situations it is desirable to temporarily turn this off. See demo for example.) 4. Assign an OnDrop event (ie: what to do when files are dropped on your component). When this event is triggered the files that have been dropped are listed in FileList and the DropPoint is also assigned. DISCLAIMER: This software may be freely used but no guarantees are given as to reliability. Please keep this header to acknowledge source. USE AT YOUR OWN RISK. PROBLEMS/COMMENTS/THANKS ... ajohnson@rpi.net.au

Constructors


constructor Create(AOwner: TComponent);



Functions

destructor Destroy;


function GetFileCount: integer;


procedure Notification(comp: TComponent; Operation: TOperation);


procedure SetEnabled(Enabl: boolean);


procedure SetTarget(targ: TWinControl);

Reverse subclassing

procedure DropFiles( hDropHandle: HDrop );


procedure WndProc( var Msg: TMessage );

Subclass target here

Properties

property Enabled : Boolean


property FileCount : Integer


property Target : TWinControl


Events

event OnDrop : TNotifyEvent


Variables

DropPoint : TPoint;


FileList : TStrings;


fDrop : TNotifyEvent;


fEnabled : boolean;


fTarget : TWinControl;


TargetNewWndProc : pointer;


TargetOldWndProc : pointer;



Constructors


constructor Create(AOwner: TComponent);


Functions


destructor Destroy;


function GetFileCount: integer;


procedure Notification(comp: TComponent; Operation: TOperation);


procedure SetEnabled(Enabl: boolean);


procedure SetTarget(targ: TWinControl);

Reverse subclassing


procedure DropFiles( hDropHandle: HDrop );


procedure WndProc( var Msg: TMessage );

Subclass target here


Properties


property Enabled : Boolean


property FileCount : Integer


property Target : TWinControl


Events


event OnDrop : TNotifyEvent


Variables


DropPoint : TPoint;


FileList : TStrings;


fDrop : TNotifyEvent;


fEnabled : boolean;


fTarget : TWinControl;


TargetNewWndProc : pointer;


TargetOldWndProc : pointer;