Denovo Run-Time
10/05/2003
0
Pessoal denovo estou encomodando com essa questão do run-time, mas, é que eu sou meio burrinho mesmo. Alguém me diz o que há de errado com a minha lógica. Por que estou querendo destruir os componentes que criei em run-time. Esta é a rotina que estou usando;
private
procedure CadM;
public
V:Boolean;
procedure TForm_Menu.CadM;
var E1,E2:TEdit;
begin
if V=True then
begin
E1:=TEdit.Create(Panel1);
E2:=TEdit.Create(Panel1);
E1.Parent:=Panel1;
E1.Left:=16;
E1.Top:=24;
E1.Enabled:=False;
E1.Text:=Registros;
E2.Parent:=Panel1;
E2.Left:=16;
E2.Top:=64;
E2.CharCase:=ecUpperCase;
end
else
begin
E1.Destroy;
E2.Destroy;
end;
end;
procedure TForm_Menu.Button1Click(Sender: TObject);
begin
if V=True then
V:=False
else
V:=True;
CadM;
end;
end.
prá criar ele cria numa boa, mas, para destruir ele dá erro. Qual é o problema desta rotina?
Dede já agradeço. VALEU!
private
procedure CadM;
public
V:Boolean;
procedure TForm_Menu.CadM;
var E1,E2:TEdit;
begin
if V=True then
begin
E1:=TEdit.Create(Panel1);
E2:=TEdit.Create(Panel1);
E1.Parent:=Panel1;
E1.Left:=16;
E1.Top:=24;
E1.Enabled:=False;
E1.Text:=Registros;
E2.Parent:=Panel1;
E2.Left:=16;
E2.Top:=64;
E2.CharCase:=ecUpperCase;
end
else
begin
E1.Destroy;
E2.Destroy;
end;
end;
procedure TForm_Menu.Button1Click(Sender: TObject);
begin
if V=True then
V:=False
else
V:=True;
CadM;
end;
end.
prá criar ele cria numa boa, mas, para destruir ele dá erro. Qual é o problema desta rotina?
Dede já agradeço. VALEU!
Toshio Bruno
Curtir tópico
+ 0
Responder
Posts
10/05/2003
Adilsond
private
{ Private declarations }
E1,
E2: TEdit;
procedure CadM;
public
{ Public declarations }
V: Boolean;
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.CadM;
begin
if V = True then
begin
E1 := TEdit.Create(Panel1);
E2 := TEdit.Create(Panel1);
E1.Parent := Panel1;
E1.Left := 16;
E1.Top := 24;
E1.Enabled := False;
E1.Text := Registros;
E2.Parent := Panel1;
E2.Left := 16;
E2.Top := 64;
E2.CharCase := ecUpperCase;
end
else
begin
E1.Free;
E2.Free;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
V := not V;
CadM;
end;
end.
Responder
Clique aqui para fazer login e interagir na Comunidade :)