home *** CD-ROM | disk | FTP | other *** search
- {##
- LED - Component with blinking capabilities v1.1
- written 1996 by Markus Plesser (e9300600@stud1.tuwien.ac.at)
-
- Source-code is provided as is. You are not allowed to give this code
- away (even to your best friends ;-).
-
- If you have any suggestions or comments please mail me in english or german
- to the above stated adress.
-
- Revision history:
- =================
- ** 27.06.1996 - Created, Initial Release 1.0
- ** 17.09.1996 - Added onClick-Event -> v1.1
-
- P.S.: I┤m from Austria so please accept my apologies for my bad English ;-)
- }
-
- unit Led;
-
- interface
- uses
- SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
- Forms, Dialogs, ExtCtrls;
-
-
- type
- TLEDColorType = (Red, Blue, Green, Yellow, Fuchsia, Grey, Aqua, White);
- TLEDState = (LEDOn, LEDOff);
-
- type
- TLED = class(TGraphicControl)
- private
- FLEDColor: TLEDColorType;
- FLEDState: TLEDState;
- FBlinking: Boolean;
- LEDTimer: TTimer; {## Used for blinking }
- BlinkState: Boolean; {## Which blinkingstate am I in ? }
- procedure Paint; override; {## Redraw Bitmap }
- procedure writeFLEDColor(aColor: TLEDColorType); {## Set color }
- procedure writeFLEDState(aState: TLEDState); {## Set to On/Off }
- procedure writeFLEDBlinking(aState: Boolean); {## Make it blink }
- procedure writeTimerInt(aInt: Integer); {## Set blinking-interval }
- function readTimerInt: Integer; {## Get blinking-interval }
- procedure LEDTimerEvent(Sender: TObject); {## Change blinking-state }
- public
- constructor Create (aOwner: TComponent); override;
- published
- property Width default 17;
- property Height default 17;
- property Color: TLEDColorType read FLEDColor
- write writeFLEDColor;
- property State: TLEDState read FLEDState write writeFLEDState;
- property Blinking: Boolean read FBlinking write writeFLEDBlinking;
- property BlinkInterval: Integer read readTimerInt write writeTimerInt;
- property onClick;
- end;
-
- procedure Register;
-
- implementation
-