TLCD99
ReadMe
By
Jonathan Hosking
V1.64 (01/02/2000)
Table
of Contents
What
is the TLCD99 Component?
How
to install the TLCD99 component
TLCD99 Reference
Revision History
Future Ideas
Other Components
Contacting Me
What is
the TLCD99 component?
The TLCD99 component
is a new component I have written for Delphi and C++Builder. It simply looks
like an LCD display, but there is more to it than you think. It can be fully
customised if desired. It has the following features: -
- Fully customisable
source code, which can be edited if necessary.
- A popup menu
can be used with the control.
- Doesn't require
bitmaps to operate. It simply generates the LCD digits.
- LCD digits can
be adjusted in size and space.
- The display
can be updated with an animation effect.
- Works on Windows
95 and NT. (I have not tested it with Windows 98)
- Compact size,
only occupying 20KB when compiled in Delphi 1! (17KB in Delphi 5!)
The component code
was written by modifying some code for my TYearPlanner component. The code works
fine on Delphi 1.0, 2.0, 4.0, 5.0 and C++Builder 3.0, but I have not tested
it with other versions.
You are free to
distribute the code, but you may NOT sell it. If you modify the code, you must
include me in the acknowledgements. If you do want your ideas or modifications
to be incorporated into the latest version, send them to the address at the
end of this document.
Thanks to Jean
Pierre and Daniel Szasz
for their help with the drawing routines and colon support routines.
Thanks to
Alan Warriner
for implementing double buffering, the animation preview feature, and improving
the animation delays.
How to
install the TLCD99 component
To unzip the TLCD99
component, assuming [Program Path] is the path to Delphi or C++Builder,
follow these steps: -
- Unzip the file
LCD99.ZIP to any directory, using the directory switch (This is VERY
important).
- Copy the file
LCD99.PAS to the directory [Program Path]\Source\Samples.
- If you want
documentation, copy the file LCD99.HTM to the directory [Program
Path]\Bin, if you are using Delphi 1.0. Otherwise, copy it to the directory
[Program Path]\Help.
- If you are using
Delphi 1.0, copy the files in the 16-Bit directory of this Zip to the
directory [Program Path]\Source\Samples. Otherwise, copy the files
in the 32-Bit directory of this Zip to the directory [Program Path]\Source\Samples.
You can now install
the component into the component library. Follow the procedure for the version
of Delphi or C++Builder that you are using.
Delphi
1.0:
- Click on Options
and then select Install Components.
- In the Install
Components dialog, click Add. In the next dialog, click Browse
and open the file LCD99.PAS.
- Click Ok
to install the component.
Delphi
2.0:
This procedure
should also work with C++Builder 1.0, but I'm not sure.
- Click on Component
and select Install.
- In the Install
Components dialog, click Add. In the next dialog, click Browse
and open the file LCD99.PAS.
- Click Ok
to install the component.
Delphi
4.0:
- Click on Tools
and select Environment Options.
- In the next
dialog, click on the Library tab and add the full path of the TLCD99
source code to the Library Path edit box. Then click Ok.
- Click on Component
and select Install Component.
- In the Install
Component dialog, click on the Into existing package tab. Click
on the first Browse button and open the file LCD99.PAS. Then
click on the second Browse button and open the file DCLUSR40.DPK.
Finally, click Ok to install the component.
Delphi
5.0:
- Click on Tools
and select Environment Options.
- In the next
dialog, click on the Library tab and add the full path of the TLCD99
source code to the Library Path edit box. Then click Ok.
- Click on Component
and select Install Component.
- In the Install
Component dialog, click on the Into existing package tab. Click
on the first Browse button and open the file LCD99.PAS. Then
click on the second Browse button and open the file DCLUSR50.DPK.
Finally, click Ok to install the component.
C++Builder
3.0:
This procedure
should also work, with minor modifications, with Delphi 3.0 and C++Builder 4.0,
but I'm not sure.
- Click on Tools
and select Environment Options.
- In the next
dialog, click on the Library tab and add the full path of the TLCD99
source code to the Library Path edit box. Then click Ok.
- Click on Component
and select Install Component.
- In the Install
Component dialog, click on the Into existing package tab. Click
on the first Browse button and open the file LCD99.PAS. Then
click on the second Browse button and open the file DCLUSR35.BPK.
Finally, click Ok to install the component.
TLCD99
Reference
Remarks:
If your digits
do not display correctly, you may have done one of the following: -
- You may have
chosen an unsuitable segment size.
- You may have
chosen an unsuitable gap size for the segments.
- You may have
an inappropriate number of digits for the component size. Try adjusting the
size or reducing the number of digits.
- You may not
have enough digits to display the value.
- You may have
chosen unsuitable colours for inactive and active segments.
You can edit the
digit data by changing the values in the array LCDDisplayData. The array
consists of 38 digit sets, each comprising of 8 segments that can be turned
on or off. The first 10 sets are the digits 0 to 9, the next 2 sets are the
sign digit and colon, and the last set is the letters of the alphabet. A value
of 0 turns a segment off, while a value of 1 turns the segment on. A diagram
of the segment layout is included in the source code.
You can edit the
animation patterns, if you wish, by changing the values in the variable LCDAnimationData.
There are sub-arrays for each animation, each containing a list of segment numbers.
The animation of drawn in the order of the segment numbers. Below is a list
of the animations: -
- Spiral animation.
- Up animation.
- Down animation.
- Right animation.
- Left animation.
You can add your
own animations if you wish, but you will need to make some modifications. I
do not support this, however. If you want your animations in future releases,
send the new array list to me.
The animation delay
is not entirely accurate at the moment. For example, if you specify a delay
of 1000 then the control may take slightly over a second to update. If anyone
can find a solution to this, please contact me, but it's not a major problem.
Known
Problems:
There is currently
one known problem with the control, but hopefully it will be fixed in future
versions. It is listed below: -
- The control
takes some time to update itself when you are using animations. I have not
yet found a solution to this problem, but it is only a minor problem.
Key Properties:
- property
About;
If
you set this to abAbout, the component information is shown.
- property
Align;
Determines
how the control is aligned within its parent.
- property
Animation;
Determines
the animation that is used to update the display. Selecting anRandom
chooses a random animation per update.
- property
AnimationDelay;
Specifies
the delay in an animation for updating whole the display.
- property
Color;
Determines
the colour of the control.
- property
DigitNum;
Determines
the number of digits that are displayed on the display.
- property
DigitSpacing;
Determines
the amount of space, in pixels, between digits.
- property
DoubleBuffer;
If
this is set to True, double buffering is enabled.
-
property DragCursor;
Determines
the mouse pointer that is displayed when an object is dragged over the control.
- property
DragMode;
If
this is set to automatic, the control can be dragged and dropped at any time.
If this is set to manual, the control can only be dragged when the BeginDrag
method is called.
- property
Enabled;
If
this is set to False, the control cannot be used until this is set
to true.
- property
GapX;
This
determines how much horizontal space is unused by a segment.
- property
GapY;
This
determines how much vertical space is unused by a segment.
- property
IsPainting;
Indicates
if the control is painting itself.
- property
OffColor;
This
is the colour used for displaying inactive segments.
- property
OnColor;
This
is the colour used for displaying active segments.
- property
PaintDuration;
Indicates
the time spent on painting the control.
- property
ParentShowHint;
If
this is set to True, the parent of the control displays the hints.
- property
PopupMenu;
If
this is set, right clicking the control displays the set popup menu.
- property
Preview;
If
this is set to True, the animations can be previewed at design time.
- property
SegmentSize;
This
determines the size of the segments.
- property
ShowHint;
If
this is set to True, the control displays its own popup hints.
- property
Value;
Determines
the value that is displayed. You can enter any number and create spaces between
digits by using space characters.
- property
Visible;
If
this is set to False, the control cannot be seen.
Key Events:
- property
OnClick: TNotifyEvent;
Occurs
when the control is selected.
- property
OnDblClick: TNotifyEvent;
Occurs
when the control is double-clicked.
- property
OnDragDrop: TNotifyEvent;
Occurs
when an object being dragged is dropped.
- property
OnDragOver: TNotifyEvent;
Occurs
when an object is dragged over the control.
- property
OnEndDrag: TNotifyEvent;
Occurs
whenever the dragging of an object ends, either by dropping the object or
by cancelling the dragging.
- property
OnMouseDown: TNotifyEvent;
Occurs
when a mouse button is pressed with the pointer over the control.
- property
OnMouseMove: TNotifyEvent;
Occurs
when the pointer is moved whilst over the control.
- property
OnMouseUp: TNotifyEvent;
Occurs
when a mouse button that was pressed is released with the pointer over the
control.
Revision
History
V1.64 (01/02/2000)
- Bug Fixed -
In the previous version, the wrong alphabetical characters were displayed.
V1.63 (12/01/2000)
- Added a DoubleBuffer
property for double buffering. Thanks to Alan
Warriner for this.
- Added an IsPainting
property to indicate when the control is being painted. Thanks to Alan
Warriner for this.
- Added a PaintDuration
property to indicate the painting speed. Thanks to Alan
Warriner for this.
- Added a Preview
property to enable the user to preview animations at design time. Thanks to
Alan Warriner
for this.
- Improved the
animation delays in the animations. Thanks to Alan
Warriner for this.
V1.62 (04/09/1999)
- Delphi 5.0 is
now supported!
V1.61 (17/08/1999)
- Added a message
hook to help reduce flickering.
V1.6 (12/08/1999)
- Added support
for the colon. Thanks to Daniel
Szasz for providing the original code for this.
V1.5 (07/08/1999)
- Added GapX,
GapY and SegmentSize properties to the control, which control
the segment sizes. The ScaleX and ScaleY properties have been
removed because of this.
- Letters of the
alphabet and decimal points can now be displayed.
- Made some improvements
to the segment drawing routines.
V1.4 (13/07/1999)
- Bug Fixed -
In the value setting routine, invalid characters were occasionally allowed
to slip through unnoticed.
- Made a few improvements
to the animation delays. The delay now takes into account how long the control
has spent updating itself, so the delay should be more accurate.
V1.3 (09/07/1999)
- The control
now supports negative numbers. To leave the display blank, you now enter nothing
in the value property.
- Digits can now
be separated within the display by using space characters.
V1.2 (28/06/1999)
- The control
now correctly updates itself when a value of –1 is entered.
- The control
is more efficient at updating itself, and the animation delays are more realistic.
In previous versions, the delay could vary at times.
V1.1 (26/06/1999)
- The control
now looks a little bit more like a real LCD display. Thanks to Jean
Pierre for his help.
- The control
now correctly identifies C++Builder 4.0. In earlier versions I used the wrong
compiler version check, meaning that C++Builder 4.0 users would probably have
encountered errors.
V1.0 (28/05/1999)
Future
Ideas
I currently only
have one idea for future versions of the TLCD99 component. It is shown below:
-
- Improved animation
updating. At the moment I have to disable messages while the control updates,
otherwise I can get errors.
Other
Components
Below is a list
other components that I have written: -
- TOffice97Balloon
– A control that looks and acts like the Office Assistant balloons in Office
97.
- TOffice97Button
– A control that looks and acts like the controls (Buttons, radiobuttons,
up buttons and down buttons) that appear in the Office Assistant balloons
in Office 97.
- TYearPlanner
– A control that looks like a year planner.
Contacting
Me
I am currently
on the Internet. If you have any bug reports, comments, ideas, modifications,
etc. then you can Email me at the address given below. You can also go to my
web site to find out the latest information on my components.
Email: - jonathan@the-hoskings.freeserve.co.uk
WWW:
http://www.the-hoskings.freeserve.co.uk/