Unit uDragFilesSrc |
Classes |
TDragFilesSrc - WIDE character switch
Functions |
Register - =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Register
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Types |
PDropFiles
TDragResult
TDropEffect
TDropFiles
Constants |
Variables |
Functions |
Types |
PDropFiles = ^TDropFilesFrom SHLOBJ unit
TDragResult = (drInvalid, drCancelled, drDropped);TDragFilesSrc Component © Angus Johnson ajohnson@rpi.net.au Version 1.0 September 1997. DESCRIPTION: Enables dragging of files FROM your Form TO Windows Explorer and other applications which can receive files. Single or multiple files can either be MOVED or COPIED. PUBLISHED PROPERTIES: DropEffect: TDropEffect (deCopy, deMove) VerifyFiles: boolean PUBLIC PROPERTIES: (not available at design time) FileCount: TStringList (read only) PUBLIC METHODS: AddFile(string) AddFiles(Tstrings) ClearFiles Execute: TDragResult (drInvalid, drCancelled, drDropped) OnDropping: TNotifyEvent USAGE: 1. Add this non-visual component to the Form you wish to drag from. 2. Set DragEffect to either deMove or deCopy. 3. Before the Execute function is called, files need to be added to the FileList using one of the following functions - DragFilesSrc1.AddFile(filename:string); DragFilesSrc1.AddFiles(FileList: Tstrings); and DragFilesSrc1.ClearFiles - to clear files! 4. The function Execute (starts the drag operation). This function is usually called in a MouseDown or MouseMove method and has no parameters. The function returns - drInvalid, drCancelled, or drDropped - depending on success. 5. The OnDropping event is triggered (if assigned) immediately after the mouse is released at a valid drop point. This event may be used in the following situations (as examples):- Extracting files from an archive; or Downloading files from the net. It is MUCH more efficient to do these procedures here rather than in the method calling the Execute function, as the drag operation may be cancelled without the need for extracting or downloading files at all. In these 2 examples extract or download files into the temp directory (GetTempPath API) using this OnDropping event method, then move them from the temp directory by setting DragEffect to deMove. 6. Set VerifyFiles to either true or false. If true this verifies the existance of files on Execute and will immediately return 'drInvalid' if any one file listed does not exist. However, you may not wish to check for the existance of the files until the OnDropping event occurs (when the mouse is released at a valid drop point) as they may not even be created till then! (See the above examples.) Obviously, set VerifyFiles prior to calling the Execute function. 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
TDropEffect = (deCopy, deMove);
TDropFiles = record
pFiles : DWORD;
pt : TPoint;
fNC : BOOL;
fWide : BOOL;
end;
Constants |
Variables |