{
 Por Ericson Benjamim
 30 de Novembro de 2010
 Adaptado da versao em Delphi publicado em http://www.delphidicas.com.br/dicas/163/Criando-um-letreiro-digital.html
}
unit Unit1;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
  ExtCtrls, StdCtrls, Spin;

type

  { TForm1 }

  TForm1 = class(TForm)
    Button1: TButton;
    Button3: TButton;
    Edit1: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Panel1: TPanel;
    SpinEdit1: TSpinEdit;
    SpinEdit2: TSpinEdit;
    Timer1: TTimer;
    procedure Button1Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure SpinEdit1Change(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
  private
    { private declarations }
  public
    { public declarations }
    Inverter: Boolean;
  end; 

var
  Form1: TForm1; 

implementation

{ TForm1 }

procedure TForm1.FormCreate(Sender: TObject);
begin
  Panel1.BevelOuter := bvNone;
  Panel1.Caption    := '';
  Inverter          := false;
  Label1.Left       := Panel1.Width;
end;

procedure TForm1.SpinEdit1Change(Sender: TObject);
begin
  Timer1.Interval := SpinEdit1.Value;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
  Label1.Caption := Edit1.Text;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Inverter := not Inverter;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  if Inverter then begin
    if label1.Left = Panel1.Width then
      Label1.Left := -(Label1.Width)
    else
      Label1.Left := Label1.Left + SpinEdit2.Value;
  end else begin
    if Label1.Left + Label1.Width <= 0 then
      Label1.Left := Panel1.Width
    else
      Label1.Left := Label1.Left - SpinEdit2.Value;
  end;
end;

initialization
  {$I Unit1.lrs}

end.

