TDropWatch component
Version 1.1
Table of Contents
1. Credits and Disclaimer
2.
Purpose
3.
How to Install
4.
How to Use
5.
Release Notes
1. Legal
Stuff
TAdvMsg was written by Sven
Künzler
<svenk@gmx.net>
If you understand german language
you might want to visit my homepage at
http://www.xwatch.de/.
If you speak english there is an english version of my Delphi pages at
http://www.xwatch.de/en/delphi/.
This component uses code written by
-
Troels S. Eriksen
-
Brad Stowers
-
Borland International
Thanks to you guys!
Disclaimer:This product is
released as public domain, which means:
I make no restrictions about using it and you
do not expect any guarrantees from me.
[Top]
2.Purpose
TDropWatch
will launch an event every
time the user drags a file from Windows Explorer onto the attached control.
[Top]
3. How to Install
TDropWatch
was designed for Delphi 2.0.
However, it should work with other Delphi versions with little/no changes.
-
Back up your components library. It's the
file "cmplib32.dcl" located in the "bin" directory
-
Choose Install from the Components menu of
Delphi.
-
Add the file drwatch.pas to the list and recompile
your library.
This is the installation procedure for Delphi 2. For other versions, please refer to the online help.
[
Top]
4. How to Use
TDropWatch has the following properties:
When True, the component will inform you about
files being dropped onto the attached control. When False, it won't (so
what?). Default is False.
WatchControl: TWinControl;
This property specifies the control which
the user shall be able to drop files onto. This can be any visible control,
for instance a panel, a button or a memo field. If WatchControl is
NIL, the component will not be watching anything. Default is NIL.
OnFilesDropped(Sender: TObject, X,Y:
Integer, File: TStringList);
This event occurs when files are dropped on
the attached control. Note the difference to previous handling:
You get ALL filenames in ONE event as string list. TDragDropPanel gave
each filename in a single event.
[Top]
5.Release
notes:
The changes in version 1.1 were entirely
written by Troels S Eriksen. Thanks for your contribution!
This release fixes two small problems.
First of all, Troels implemented the notification method that prevents
TDropWatch from crashing when the attached control is destroy()ed.
Furthermore, changes were made to allow
TDropWatch to be attached to a TMemo component.
In the current release, there are still
the following "issues" (which were called "bugs" before microsoft ruled
the earth)
-
You cannot attach TDropWatch to a TForm. Workaround:
Place a TPanel with alClient-Alignment onto the TForm and attach TDropWatch
to the panel.
-
There may be a problem about how I handle
the hooking of the attached control:
The point is that I need to know whether
the control still exists or if it was destroyed during program termination.
My conclusion was to intecept the WM_DESTROY message the control gets before
it dies.
Thus, if WM_DESTROY is sent, I unhook
my TDragWatch component from the control. Now I wonder if that's really
allowed, because I remove the hook from within itself. I have experienced
no problems with this method, yet I feel a little unconfortable about it.
So, if you are familar with Windows' DefaultWindowProc
handling, I would like to hear your comment about the Hook,
Unhook, HookWndProc
methods in drwatch.pas.
If you find bugs in the component or make
improvements to it, please let me know.
Have fun,
Sven Künzler
Reessum,
20.09.99
[
Top]