unit ShBlinkLabel;
interface
uses
StdCtrls, ExtCtrls, Classes;
type
TShBlinkLabel =
class(TLabel)
private
fTimer: TTimer;
fIntervall: integer;
fAktiv: boolean;
protected
procedure OnTimer(Sender: TObject);
procedure SetAktiv(aValue: boolean);
procedure SetIntervall(aValue: integer);
public
constructor Create(AOwner: TComponent);
override;
destructor Destroy;
override;
property Intervall: integer
Read fIntervall
Write SetIntervall;
property Aktiv: boolean
Read fAktiv
Write SetAktiv;
published
end;
implementation
{ TShBlinkLabel }
constructor TShBlinkLabel.Create;
begin
inherited;
fAktiv := False;
fTimer := TTimer.Create(self);
fTimer.OnTimer := OnTimer;
fTimer.Interval := 500;
fTimer.Enabled := fAktiv;
end;
destructor TShBlinkLabel.Destroy;
begin
fTimer.Free;
inherited;
end;
procedure TShBlinkLabel.OnTimer(Sender: TObject);
begin
Visible :=
not (Visible)
end;
procedure TShBlinkLabel.SetAktiv(aValue: boolean);
begin
fAktiv := aValue;
fTimer.Enabled := aValue;
end;
procedure TShBlinkLabel.SetIntervall(aValue: integer);
begin
fTimer.Enabled := False;
fTimer.Interval := aValue;
fTimer.Enabled := True;
end;
end.