Labeled Input Controls
======================

  Date:       August 28, 1996
  Version:    1.06 (for Delphi 1.0 and 2.0)
  Package:    LBLINPUT.ZIP
  Status:     Shareware (with source code!)
  Price:      U.S. $5
  Programmer: Eric G.V. Fookes
  E-Mail:     fookes@sc2a.unige.ch
  http://www.unige.ch/sciences/terre/geologie/fookes/delphi.htm


CONTENT:
 1. Synopsis
 2. Audience
 3. Introduction
 4. The Labeled Input Controls
 5. Installation
 6. Shareware Registration
 7. Pricing Information
 8. Distribution License for this Software
 9. Legal
10. Where to Obtain the latest Version
11. The New Methods and Properties Explained
12. Comments and Suggestions
13. Revision History


1. Synopsis
-----------
Input components with attached labels for TEdit, TMaskEdit, 
TMemo, and TComboBox and the data-aware equivalents of TEdit, 
TMemo, and TComboBox.


2. Audience
-----------
Delphi programmers and dedicated component users.


3. Introduction
---------------
Do you usually add input controls (TEdit, TMemo, TComboBox, etc.) 
on a form without adding a label to identify it? If you work as I 
do, probably not very often. Do you also find it difficult to align 
the label properly with respect to its input control. All this takes 
up an unnecessary lot of time when you are designing the user 
interface.

Also, when you add a label to an input control and assign its 
FocusControl property, don't you wish it would focus on the control 
when you click on the label at runtime?

Well, here are my Labeled Input Controls. They provide many new
features, improve several standard ones, and save you lots of time
during the design phase. I hope you will find them useful!

Some of the Special Features:
.............................

* Labels are automatically created and attached to input controls;
* properties to easily and accurately position label with respect
  to its input control;
* labels resize properly when forms run under different resolutions;
* when input control is moved (at design or runtime), attached label
  moves with it;
* when input control is disabled or hidden, the attached label does
  the same.


4. The Labeled Input Controls
-----------------------------
The units EF_EDIT and EF_DBEDT comprises nine enhanced 
components. The two first ones provide useful new features that 
are then inherited by the main components of this unit, i.e. the 
labeled input components.

The components are fully functional (not crippled in any way) and 
complete source code is provided. For those interested, I have
provided comments in the source code for the implementation of the
TLblEdit component.

TEnhMemo is based on TMemo and adds:
- method to set tab stops in memo field;
- methods to undo changes;
- methods to determine the cursor's row and column;
- method to print the memo text.

TEnhLabel is based on TLabel and adds:
- sets focus to its FocusControl when clicked with mouse.
- goes dark grey (by default) when disabled. Normal labels 
  become grey and cannot be distinguished from background.

TLblEdit is based on TEdit and adds:
- property for attached label component;
- property for label caption;
- property for label position (above, left, below, right of 
  component, or custom position);
- property for margin size separating label from control;
- property for appending a colon (:) at the end of the caption.

TLblMaskEdit is based on TMaskEdit and adds:
- same new properties as TLblEdit.

TLblMemo is based on TEnhMemo and adds:
- same new properties as TLblEdit.

TLblComboBox is based on TComboBox and adds:
- same new properties as TLblEdit.

TDbLblEdit, TDbLblMemo, TDbLblComboBox are data-aware equivalents 
of the above.

To save on resources, the labels attached to the input controls 
only exist once the LabelText property has been assigned some 
text. When this is done, you can select the label at design time 
and change any of the label's properties as a normal component 
(NB: there is also a property to reference the label at run-
time). If you delete the input control, then its label is also 
deleted. If you hide/show or enable/disable the input control, 
its label will do likewise. If you move or resize the input 
control, its label will automatically reposition itself 
(unless you choose to set its position to a "custom" value).

You will find more details on the properties at the end of this 
document.


5. Installation
---------------
1. Copy the files EF_EDIT.DCU, EF_EDIT.DCR, EF_DBEDT.DCU, 
EF_DBEDT.DCR to your DELPHI\LIB directory.

2. From the "Options" Menu, select "Install Components". Press 
the "Add" button, and then the "Browse" button. Go to the LIB 
directory, and select UNIT file types (*.DCU). Then select 
EF_EDIT.DCU and press "OK". Then press "OK" for the Install 
Components dialog box. Repeat the same procedure for EF_DBEDT.DCU 
if you want to install the data-aware version of these controls 
(please note that EF_DBEDT.DCU requires EF_EDIT.DCU to operate).

3. When Delphi is done compiling there will be nine new 
components in the "LblIC" palette.

Note: Be careful that there aren't any other units (*.DCU, *.PAS) 
that have the same name in your include path.


6. Shareware Registration
-------------------------
This component is shareware, and is distributed to be used for a 
limited trial period of 30 days. You are free to copy and 
distribute this software in unmodified form. After the 30 day 
period the software should be registered or removed from the 
user's system. If the component is to be included in a commercial 
or government application, it must be registered (i.e., paid 
for).


7. Pricing Information
----------------------
Registering these Labeled Input Controls is only U.S. $5 
(equivalent local currency accepted). Here in Switzerland, thats 
just enough to buy two or three cups of coffee! Due to the low
cost, please DO NOT send your payment in the form of a check
(our banks refuse them). The cheapest and easiest way for both 
you and me is simply to put the appropriate amount of cash (if 
possible concealed so we don't tempt the postman) in an envelope. 
Please also enclose a note indicating the product name and version 
number (e.g. Labeled Input Controls v1.06), your name and address 
(your E-mail too if you would like to be notified of updates) and 
send it to:

  Eric G.V. Fookes
  Av. Eugne-Pittard 22 Ter
  CH - 1206 GENEVA
  Switzerland


8. Distribution License for this Software
-----------------------------------------
I encourage you to freely copy and distribute this Shareware 
version of my Labeled Input Controls to any and all who are 
interested in obtaining a copy, including distributing it on 
BBS's or shareware distribution libraries. The package is subject 
to the following restrictions:

The Labeled Input Controls package must be distributed as a 
complete package including the following 7 Files:

   EF_EDIT.TXT    - this file
   EF_EDIT.DCU    - compiled unit
   EF_EDIT.DCR    - toolbar icons
   EF_EDIT.PAS    - source code
   EF_DBEDT.DCU   - compiled unit for data-aware components 
                    (requires EF_EDIT.DCU)
   EF_DBEDT.DCR   - toolbar icons for data-aware components
   EF_DBEDT.PAS   - source code for data-aware components

If any of these files are missing, then the package is not 
complete and distribution is forbidden.

- The package - including all related program files and 
documentation files CANNOT be modified in any way and must be 
distributed as a complete package, without exception.

- You may charge a distribution fee for the package, but you must 
not represent in any way that you are selling the software 
itself.

- You shall not use, copy, rent, lease, sell, modify, decompile, 
disassemble, otherwise reverse engineer, or transfer the licensed 
program except as provided in this agreement. Any such 
unauthorized use shall result in immediate and automatic 
termination of this distribution license.

All rights not expressly granted here are reserved by Eric G.V. 
Fookes.


9. Legal
--------
The author of these components accepts no responsibility for 
damages resulting from their use and makes no warranty or 
representation, either express or implied, including but not 
limited to, any implied warranty of merchantability or fitness 
for a particular purpose. These components are provided "AS IS", 
and you, its user, assume all risks when using it.


10. Where to Obtain the latest Version
--------------------------------------
You will find the latest version of these components and others 
(Freeware and Shareware) on the World Wide Web from my home page 
which you will find at the following address:

http://www.unige.ch/sciences/terre/geologie/fookes/delphi.htm


11. The New Methods and Properties Explained
--------------------------------------------

TEnhLabel:
++++++++++

* property DisabledColor:TColor;
Define colour of label when it is disabled. 
Default value is clBtnShadow.

TEnhMemo:
+++++++++

* procedure SetTabStops(Tabs: array of Word);
Define tab stop values for the memo text. 
Eg. SetTabStops([16,35,50]);

* procedure Copy2Printer;
Prints memo text.

* procedure ResetUndoFlag;
Use this method when you want the CanUndo function to return 
false before memo text is changed again.

* function  CanUndo:Boolean;
This function returns true if the memo text has changed since the 
ResetUndoFlag was called.

* procedure UndoEdit;
This method resets the memo text to its original state when the 
ResetUndoFlag was called.

* procedure CurrentCursorPos(var Row,Col:Integer);
Retrieve the current cursor position in the memo text.

* function  CursorRow:Integer;
Returns the row in which the cursor is situated.

* function  CursorCol:Integer;
Returns the column in which the cursor is situated.

TLblEdit, TLblMaskEdit, TLblMemo, TLblComboBox,
TDbLblEdit, TDbLblMemo, TDbLblComboBox:
+++++++++++++++++++++++++++++++++++++++++++++++

* function HasLabel:Boolean;
Returns true if the input control has a label.

* property LabelComponent:TLabel read FLabel write SetLabel;
Points to the attached Label component. Can be a pre-
existing TLabel component or descendant, or the internally
created TEnhLabel component. The label must (of course) be
on the same form as the input control.

* property LabelText:string read GetLabel write SetLabel;
Property for reading or setting the caption of the input 
control's label.

* property LabelPos:TLabelPos read FLabelPos write SetLabelPos 
           default lpTop;
Property for reading or setting the position of the input 
control's label with respect to the input control. Can be placed 
above, below, left or right of the input control, or at a
custom location. If the parent of both components is
different, then only custom location can be set.

* property LabelMargin:Integer read FMargin write SetMargin 
           default 2;
Determines amount of space in pixels separating the label from 
the input control. Ignored if LabelPos is set to lpCustom.

* property LabelColon:Boolean read FAddColon write SetAddColon;
When true, adds a colon to the caption.


12. Comments and Suggestions
----------------------------
Don't hesitate to send me your comments and suggestions. I can 
be reached by E-mail on the Internet at fookes@sc2a.unige.ch.
Please note that I am usually very busy with my various projects 
(too many!). As a result, I may not be able to answer every 
message I receive.




Thank you for choosing to evaluate my Labeled Input Controls and 
even more so when you register!
-Eric Fookes



13. Revision History
--------------------
Version 1.00
   Released March 6, 1996

Version 1.01
   Released March 11, 1996
   Changes:
   * Added lpCustom option for LabelPos property. When this option
     is set, the input control does not affect the label's position.
   * Renamed ComponentLabel property to LabelComponent, made it
     read and write, and published it. Standard TLabel component 
     can be assigned to this property.
   * Added properties to TEnhLabel so that attached input control
     is notified of any changes that could affect label's position.
   * Improved the implementation and made better use of some of 
     Delphi's less well documented features.

Version 1.02
   Released March 16, 1996
   Changes:
   * Added two exceptions for each labeled control. One to ensure 
     that the attached label is on the same form as the input 
     control. The other to forbid values other than custom for the 
     LabelPos property if the attached-label's parent is different 
     from the input-control's parent.

Version 1.03
   Released April 16, 1996
   Bug fix:
   * There was a bug in earlier versions that appeared when one 
     of these labeled controls was placed on a TPanel component. 
     Destroying the TPanel (other than through the destruction of 
     the owner form) when it contained a labeled input control 
     caused a nasty GPF. This was due to an oversight in the 
     DestroyLabel method. Indeed, the form (= Owner) is not the 
     only window control that will destroy its owned components 
     when in the process of being destroyed, the parent control 
     does it too. Therefore it is necessary to also test if the 
     parent of the label is being destroyed, thereby causing 
     the destruction of the labeled input controls placed on it.
   Changes:
   * Source code modified for full compatibility with Delphi 2.0
   * I've moved, so please take note my new address when you 
     register!

Version 1.04
   Released May 15, 1996
   Changes:
   * Added published property to TEnhLabel which lets you define 
     a colour for when it is disabled (standard labels usually 
     become invisible when Enable = False).
   * When the Enable property of an input control is changed, its 
     attached label is also enabled or disabled.

Version 1.05
   Released May 24, 1996
   Changes:
   * Improved the behaviour of the new TEnhLabel's Disabled
     property. Note that when TEdit's Enable property is set
     to False at design time, nothing happens to its appearence
     and it will not appear greyed-out at run-time (Delphi bug?).
     Nevertheless, it will behave as if it is disabled.

Version 1.06
   Released August 28, 1996
   Changes:
   * When installed, components are now added to the LblIC palette.
   * When LabelPos is set to lpLeft or lpRight, the label is now
     aligned with the text in the input control instead of the top
     of the input control's window.
   * The default value for LabelPos is now lpLeft instead of lpTop
     and the default value for LabelMargin is 8 instead of 2.
   * Added global constants DefaultLabelPos and DefaultMargin to
     make it easier to change the default values for LabelPos and
     LabelMargin properties respectively. Use DefaultAddColon to
     change the default value for AddColon (which is now True).
   