MISCROSCROLL CONTROLS
.....................

These files describe how to implement a microscroll control
(also known as "spin control") in a true object oriented way,
without using an external DLL.

CONTENTS
........

The MSCROLL.ZIP contains 5 files:

MSCROLL.PAS: the unit which implements MicroScrolls
MSTEST.PAS:  a simple test program
MSCROLL.RES: resouce file containing the arrow bitmaps
MSTEST.RES:  resource file with a sample dialog
MSCROLL.TXT: this file

CREATING THE RESOURCE (USING RESOURCE WORKSHOP)
...............................................

If you look at MSTEST.RES you can see that the microscroll
resource has been created as a check box with the owner-draw
attribute (push buttons and radio buttons can be used
as well). The border attribute must be set.

The button should slightly overlap the associated edit
control.

THE MICROSCROLL OBJECT
......................

The TMicroScroll object is implemented as a TControl descendant.

The InitResource constructor takes 3 params:

- ID:  MicroScroll ID
- AID: associated edit control ID
- Stp: value of increments/decrements

When the microscroll is pushed it sends a
wm_User+wm_MicroScroll message to the associated
edit ctrl (AID).

Msg.wParam contains the ID of the button which was
pressed (ms_UpBtn=1 or ms_DnBtn=2)

Msg.lParam contains the value of the increment*100
this trick allows increments with 2 decimal places

You should define a TEdit descendant with a method to handle
the wm_MicroScroll message:

type MyEdit:object(TEdit)
              ...
              procedure WMMicroScroll(var Msg:TMessage);
                virtual wm_User+wm_MicroScroll;
              ...
            end;

This method can be used to create several other types of custom controls
(for example you can create a percent bar starting from a static control
and so on).

I used this technique in TheLister, the ultimate listing utility for
Pascal programs.

You can find it in Borland Pascal Forum - OWL/BWCC section - (GO BPASCAL)
To register on-line GO SWREG, registration ID 1412.

I learned a lot of things from the examples I downloaded from Borland
Pascal Forum, so I'm very glad to give a little contribute to the
discussion about TPW techniques.

I hope that this little documentation is quite clear.
Don't hesitate to call me if you need more info: my CIS ID is 100275,1255

Good Bye

Enrico

Enrico Lodolo
via F.Bolognese 27/3
40129 Bologna
Italy
Phone: +39 51 366939
Compuserve:100275,1255
Internet 100275.1255@compuserve.com
