LISTPLUS ver 1.1                           22/08/94


Welcome to the Subclassed ListBoxes world.

All source code, program, etc.. are FREEWARE or PUBLIC DOMAIN!!!
(except for -ctl3Dv2.DLL: Microsoft Proprietary and 
            -ctl3DV2.PAS: Borland Proprietary).

The original code (dragdrop.c) is from John A. Grant.
Yes, THE John A. Grant.
It provides drag&dropping within listboxes.

The TurboPascal code (listplus.pas) is from me. 
It provides 3 more features:
  -drag&drop copying within listboxes (movecopy).
  -drag&droping BETWEEN listboxes (drop).
  -drag&drop copying BETWEEN listboxes (dropcopy).

Thanks to Lothar Rausch few bugs were removed.

The TurboPascal code can easily be translated to C/C++. In fact,
I did translate John's C/C++ code into TurboPascal.
Pascal users would easily translate this into pascal. Few changes
need to be done.

The code was written by me and for me BUT I decided to release it
into Public Domain because it may be usefull for a lot of people.

You may distribute this code and use it in your own apps provided
you won't ask EXTRA money for the features this code gives to your apps.
This code isn't shareware: NO MONEY CAN BE ASKED FOR IT.

========
Contents:
========

ReadMe.txt   : this file.
ReadMe.rtf   : this file in Rich Text Format (for word processors).
ListPlus.Pas : a unit providing d&d features. Fully explained.
ListPlus.res : resource file (cursors and dialog for TestList.pas).
ListPlus.rc  : resource scrip (cursors and dialog for TestList.pas).
TestList.Pas : a source code of a program using this unit and testing it.
TestList.EXE : the compiled program. Needs CTL3DV2.DLL installed.
ctl3Dv2.pas *: a unit to use CTL3DV2.DLL ( (c) Borland).
ctl3DV2.DLL *: a DLL providing 3D controls ( (c) Microsoft).
               To work properly this DLL must be copied into your
               Windows/System directory (and nowhere else!!!).
               Don't copy it if a MORE RECENT one is already present.
               Can't be present in the app directory!!!!
ListDrag.ZIP : Zip file containing John A. Grant source code.


All files (except *) may be freely distributed and no part of those can
be sold. ALL OF THIS IS FREEWARE OR PUBLIC DOMAIN.

=======================
Explanation and history:
=======================

-------
History
-------

I wanted drag&drop (d&d) feature for my listboxes. I'm writing an app
in wich I want the user to add, remove, organize items in listboxes.
I came across a mail of John A. Grant on the internet news. He was 
replying to a d&d request and would send anyone a copy of his code. I
sent him an E-Mail and received his uuencoded C code.

I changed his code to use in it Turbo Pascal and realised that all my needs
weren't met. I still wanted d&d BETWEEN ListBoxes. So I wrote this code.
I added the copy feature and modify the cursors too.
And released it to public domain.


-----------
Explanation:
-----------

The source code is fully commented. Here's only an overview of all the
features provided by the code:

ListPlus.pas:
=============
The source code is a unit that implements the subclassed ListBox type.
There are different modes, each mode can be used by a MOD_xxxx flag.

MOD_move:     you can move items in the list box (origin is deleted).
MOD_movecopy: you can move items in the list box. The item, is copied to
              the destination and origin isn't deleted.
MOD_drop:     you can move items from the current listbox to an other one.
              the item is deleted from the listbox and added to the end of
	      the destination listbox (if not lbs_sort).
MOD_dropcopy: you can copy items from the current listbox to an other one.
              the item is added to the end of the destination listbox.


MOD_scroll:   when you move an item in a listbox, the listbox can scroll.
              when move is disabled (no MOD_movexxxx flags), the listbox
              won't scroll to allow you to see the item you picked.
              This flag forces scroll even when move isn't selected.

MOD_notify:   when a string is added or remove from a listbox, the parent
              window is notified by a lbn_addstring or lbn_delstring message.
              Since move don't remove or add strings no message is sent,
              except the lbn_selchange one.

MOD_external: normally, d&d between listboxes would be allowed if they
              have the same parent: listboxes in the same window. If you
              use this flag, d&d would be allowed between any listboxes.
              You may even drop items in an other app listbox. Use it
              with care!!!

All those flags can be used together => 4 different d&d modes.


When you want to use a subclassed listbox, you can create it in two
different ways:

-InitResource.
-Init.

InitResource:
------------
Use InitResource if your listbox is present in a resource file.
Position and size of the listbox are given by the resource file, you
just have to create the listbox with its id, and its mode (see above).

*AControl* :=New(PLis, InitResource(@Self, *id*,*mode*));

where:
  *AControl* is a pointer to a control (PControl)
  *id* is the id of the listbox (in your resource)
  *mode* is the mode you want for the listbox.

Init:
-----
Use Init is your listbox must be created in a TWindow or isn't present
in a resource file. You will have to pass the id, location,size and
mode of the listbox.

*AControl* :=New(PLis, Init(@Self, *id*,*x*,*y*,*w*,*h*,*mode*));

where:
  *AControl* is a pointer to a control (PControl)
  *id* is the id of the listbox (in your resource)
  *x*,*y* are the location (x,y) of the listbox
  *w*,*h* are the size (width,heigth) of the listbox
  *mode* is the mode you want for the listbox.

The cursors:
-----------
ListPlus uses 5 different cursors to show the current action.

HInterdit: d&d isn't allowed on the current location of the cursor.
HDrag:     moving an item in the current listbox.
HDragCopy: copying an item in the current listbox. (same with a plus)
Hdrop:     droping an item to an other listbox.
HDropCopy: drop-copying an item to an other listbox. (same with a plus)

If both copy and not copy are allowed, move/drop will be the default, pressing
control (as in file manager) will turn it to movecopy/dropcopy. The cursor
will change to HxxxxCopy, showing a plus. If control key is released, plus
will disappear and mode will turn back to move/drop.

If copy only is allowed, cursor will always have a plus. Control key, is
no use.
If not copy only is allowed, cursor will never have a plus. Control key is
no use.

You got it? No, run testlist.exe and test it!


testlist.pas:
============
this is the code for the testlist.exe program. It uses ctl3Dv2.dll to get
3D look for controls.

This program call a dialog box, using subclassed methods for this dialog.
Typically, the dialog creator is subclassing listbox controls using
InitResource. Only 3 of the 4 listboxes are subclassed.

*The first one is created with all four features implemented.

*The second one is created with dragcopy only feature and is in notify mode.
 This means you can only dragCOPY (see the +) from this LB to anOTHER one and
 that the dialog box will receive a message telling a string was added. Note
 that the app process only message sent to LB4.

*The third one is created with allmove feature meaning you can move items
 WITHIN the listbox and duplicate them (is you press control key).


SETUPWINDOW is modified to fill the first listbox with random items


LIST is a message related procedure that is call each time a message is sent
for the fourth listbox. The code only treats lbn_addstring message (sent
by listbox two).


=======================================================================
=======================================================================
I Hope this code will help.

If you have any comment or suggestion please send it to

  J-F CORDIER
  Laboratoire de chimie organique de synthse
  Place Louis Pasteur, 1
  B-1348 LLN
  Belgium

 or E-Mail: JF CORDIER <cordier@chor.ucl.ac.be>

I want this package as much complete as possible. I didn't take the time
to translate this code back to C/C++. I'm lazy getting lazier everyday
and I don't write apps in C/C++ (I don't have the compiler) but I
understand people like to get this code in C/C++.
If you happen to translate it into C/C++, please let me know.
Send me the translated code. We'll make another package and upload it.

======================================================================
P.S.:
This code was needed for an app which prerelease is bound to be uploaded
within a week or two. As usual for all my products, it will be FREEWARE.
See you soon, on the INTERNET.

