Fórum erro com criação de componente #366382
22/11/2008
0
Boa tarde galera !!!
Criei um package e um componente Clock herdado de TLabel aquele componente que o Guither paulli fez em uma de suas video aula, cujo código é:
unit MyLabel;
interface
uses
SysUtils, Classes, Controls, StdCtrls,ExtCtrls,Graphics;
type
TMyLabel = class(TLabel)
private
FTimer : TTimer;
procedure DoTimer (Sender : TObject);
protected
{ Protected declarations }
public
Constructor Create (AOwner : tcomponent); override;
Destructor Destroy; override;
published
{ Published declarations }
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents(´LSKComp´, [TMyLabel]);
end;
{ TMyLabel }
constructor TMyLabel.Create(AOwner: tcomponent);
begin
inherited;
FTimer.Create(Self);
FTimer.OnTimer:=DoTimer;
FTimer.Interval := 1000;
Font.Size:= 30;
Color := clBlack;
Font.Color := clLime;
DoTimer(nil);
end;
destructor TMyLabel.Destroy;
begin
FTimer.Free;
inherited;
end;
procedure TMyLabel.DoTimer(Sender: TObject);
begin
Caption := FormatDateTime(´hh:nn:ss´,Now);
end;
end.
Só que quando eu compilo e instalo o componente tudo beleza , mas na hora de colocar o componente no formulario da o seguinte erro;
Acces violation at adress 037c1ae3 in module pkclock bpl read of adress 00000000.
alguém por gentileza sabe o porque desse erro?
Desde já lhes agradeço!!![/list]
Criei um package e um componente Clock herdado de TLabel aquele componente que o Guither paulli fez em uma de suas video aula, cujo código é:
unit MyLabel;
interface
uses
SysUtils, Classes, Controls, StdCtrls,ExtCtrls,Graphics;
type
TMyLabel = class(TLabel)
private
FTimer : TTimer;
procedure DoTimer (Sender : TObject);
protected
{ Protected declarations }
public
Constructor Create (AOwner : tcomponent); override;
Destructor Destroy; override;
published
{ Published declarations }
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents(´LSKComp´, [TMyLabel]);
end;
{ TMyLabel }
constructor TMyLabel.Create(AOwner: tcomponent);
begin
inherited;
FTimer.Create(Self);
FTimer.OnTimer:=DoTimer;
FTimer.Interval := 1000;
Font.Size:= 30;
Color := clBlack;
Font.Color := clLime;
DoTimer(nil);
end;
destructor TMyLabel.Destroy;
begin
FTimer.Free;
inherited;
end;
procedure TMyLabel.DoTimer(Sender: TObject);
begin
Caption := FormatDateTime(´hh:nn:ss´,Now);
end;
end.
Só que quando eu compilo e instalo o componente tudo beleza , mas na hora de colocar o componente no formulario da o seguinte erro;
Acces violation at adress 037c1ae3 in module pkclock bpl read of adress 00000000.
alguém por gentileza sabe o porque desse erro?
Desde já lhes agradeço!!![/list]
Lsksskyblu
Curtir tópico
+ 0
Responder
Clique aqui para fazer login e interagir na Comunidade :)