Component: 	TSMemo
Description:	Memo control with added events and properties
Author:		Richard Shotbolt
Email:		100327,2305@compuserve.com
Date:		23 Jan 1996

I have been searching for a memo component which allows one to 
set and read the cursor position and scroll through memos.
Reading the Delphi forum messages, it seems that many others are
wrestling with the same problems and the solutions involve the
programmer resorting to API calls.

I thought it would be useful to incorporate these in a component
and I am therefore publishing TSMemo as a freeware TMemo
derivative which you can use and modify as you wish. Please upload
any noteworthy modifications for others to use. There seems to be
an admirable spirit of 'share and share alike' in the Delphi
community!

This is my first attempt at a component and I would like to thank
Xavier Pacheco at Borland for the initial idea and follow-up help.

<< Using TSMemo >>

TSMemo has all the properties, methods and events of a normal
TMemo, with the following additions:

<< New Properties >>

---------------------------------------------------------------------
CurrentLine - integer, read/write.

When read, returns the line number (first line = 0) containing the
cursor.

When written, the cursor is placed at the start of the specified line. 
If greater than the last line, the cursor goes to the start of the
last line. You can deliberately set a large value to get to the last
line of the control.

---------------------------------------------------------------------
CurrentPosition - integer, read/write.

When read, returns the character position (before first char = 0) of
the cursor within the line containing the cursor.

When written, puts the cursor at the specified character position 
on the current line (0 = before first character). Tabs (if used)
are treated as single characters. If the specified position is beyond
the end of the line, the cursor goes to the end of the line. You can
deliberately set a large value to get to the end of each line.

---------------------------------------------------------------------
TopLine - integer, read only

When read, returns the line number (first line = 0) of the top 
line currently displayed.

---------------------------------------------------------------------
LinesVisible - integer, read only

When read, returns the number of lines that are currently visible.
If the memo height or font properties are changed, you should call
the GetMaxLines method (see below) before reading this property.

---------------------------------------------------------------------
MaxLinesVisible - integer, read only

When read, returns the maximum number of lines that are can be
displayed in the memo before it scrolls. If the memo height or font
properties are changed, you should call the GetMaxLines method
(see below) before reading this property.

---------------------------------------------------------------------

<< New Methods >>

---------------------------------------------------------------------
GetMaxLines

Recalculates the number of lines that can be accommodated in the memo.
You only need to call this if you change the height of the memo or
change the font properties. Note: this routine will cause your TSMemo
to flash once as it temporarily creates a TMemo on top with the same
properties. I have not found a more reliable solution which avoids
this. 

---------------------------------------------------------------------
ScrollBy (X: integer; Y: integer)

Scrolls the control by X character positions left or right and Y
lines up or down. Use negative values to scroll the other way.

---------------------------------------------------------------------


<< New Events >>

---------------------------------------------------------------------
OnHScroll - generated when you click on the control's horizontal
scroll bar and again when the mouse is released.

--------------------------------------------------------------------- 
OnVScroll - generated when you click on the control's vertical
scroll bar and again when the mouse is released.

---------------------------------------------------------------------


<< Installation >>

Backup your 'complib.dcl' file as a precaution.
Select 'Options', 'Install Components'.
Select 'Add', 'Browse'.
Select the directory containing the Tsmcode files.
Select 'tsmcode.pas' and click OK on each box that appears.
The TSMemo control will be added to the 'Samples' section of your
component toolbar.
If anything goes wrong, restore your backed-up complib.dcl and try
again after correcting any obvious problems.
